Search Results

Search found 1536 results on 62 pages for 'dr monkey'.

Page 3/62 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • As a code monkey, how to discuss programming with a guy who almost has a doctorate in computer science

    - by Peter Turner
    A friend of my wife's is coming over for dinner tonight and he is a lot smarter than me. What do we have in common, well... A Bachelor's in Computer Science, and that should be enough of a conversation starter. But he's nearly completed his doctoral studies and is light years ahead of me in his particular area, which I find fascinating but don't have any legit reason to care about (except for maybe a better way through heavy traffic - he's a combinatorics guy specializing in that I think) and I got married and had some kids and am a professional programmer for medical records software. We've got a lot in common, but there's a point where neither of us care or understand each other - although I really want to learn from him and I'm not certain he'd even want to talk about his work. So for all you doctors or code monkeys, what's a good conversation starter!

    Read the article

  • How to immediately terminate crashed application?

    - by FractalizeR
    Hello. I have an application that sometimes causes exceptions. And I need to restart it if it crashed. But the problem is, that I have Windows 7 here and when application crashes, Windows shows me nice dialog box with a suggestion to close the application. But the application itself is still running until I click "Close". How to get rid of this Window and make application terminate immediately without any dialog boxes?

    Read the article

  • datagrid binding

    - by abcdd007
    using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; public partial class OrderMaster : System.Web.UI.Page { BLLOrderMaster objMaster = new BLLOrderMaster(); protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { SetInitialRow(); string OrderNumber = objMaster.SelectDetails().ToString(); if (OrderNumber != "") { txtOrderNo.Text = OrderNumber.ToString(); txtOrderDate.Focus(); } } } private void InsertEmptyRow() { DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("ItemCode", typeof(string))); dt.Columns.Add(new DataColumn("Description", typeof(string))); dt.Columns.Add(new DataColumn("Unit", typeof(string))); dt.Columns.Add(new DataColumn("Qty", typeof(string))); dt.Columns.Add(new DataColumn("Rate", typeof(string))); dt.Columns.Add(new DataColumn("Disc", typeof(string))); dt.Columns.Add(new DataColumn("Amount", typeof(string))); for (int i = 0; i < 5; i++) { dr = dt.NewRow(); dr["ItemCode"] = string.Empty; dr["Description"] = string.Empty; dr["Unit"] = string.Empty; dr["Qty"] = string.Empty; dr["Rate"] = string.Empty; dr["Disc"] = string.Empty; dr["Amount"] = string.Empty; dt.Rows.Add(dr); } //GridView1.DataSource = dt; //GridView1.DataBind(); } private void SetInitialRow() { DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("RowNumber", typeof(string))); dt.Columns.Add(new DataColumn("ItemCode", typeof(string))); dt.Columns.Add(new DataColumn("Description", typeof(string))); dt.Columns.Add(new DataColumn("Unit", typeof(string))); dt.Columns.Add(new DataColumn("Qty", typeof(string))); dt.Columns.Add(new DataColumn("Rate", typeof(string))); dt.Columns.Add(new DataColumn("Disc", typeof(string))); dt.Columns.Add(new DataColumn("Amount", typeof(string))); dr = dt.NewRow(); dr["RowNumber"] = 1; dr["ItemCode"] = string.Empty; dr["Description"] = string.Empty; dr["Unit"] = string.Empty; dr["Qty"] = string.Empty; dr["Rate"] = string.Empty; dr["Disc"] = string.Empty; dr["Amount"] = string.Empty; dt.Rows.Add(dr); //Store DataTable ViewState["OrderDetails"] = dt; Gridview1.DataSource = dt; Gridview1.DataBind(); } protected void AddNewRowToGrid() { int rowIndex = 0; if (ViewState["OrderDetails"] != null) { DataTable dtCurrentTable = (DataTable)ViewState["OrderDetails"]; DataRow drCurrentRow = null; if (dtCurrentTable.Rows.Count > 0) { for (int i = 1; i <= dtCurrentTable.Rows.Count; i++) { //extract the TextBox values TextBox box1 = (TextBox)Gridview1.Rows[rowIndex].Cells[1].FindControl("txtItemCode"); TextBox box2 = (TextBox)Gridview1.Rows[rowIndex].Cells[2].FindControl("txtdescription"); TextBox box3 = (TextBox)Gridview1.Rows[rowIndex].Cells[3].FindControl("txtunit"); TextBox box4 = (TextBox)Gridview1.Rows[rowIndex].Cells[4].FindControl("txtqty"); TextBox box5 = (TextBox)Gridview1.Rows[rowIndex].Cells[5].FindControl("txtRate"); TextBox box6 = (TextBox)Gridview1.Rows[rowIndex].Cells[6].FindControl("txtdisc"); TextBox box7 = (TextBox)Gridview1.Rows[rowIndex].Cells[7].FindControl("txtamount"); drCurrentRow = dtCurrentTable.NewRow(); drCurrentRow["RowNumber"] = i + 1; drCurrentRow["ItemCode"] = box1.Text; drCurrentRow["Description"] = box2.Text; drCurrentRow["Unit"] = box3.Text; drCurrentRow["Qty"] = box4.Text; drCurrentRow["Rate"] = box5.Text; drCurrentRow["Disc"] = box6.Text; drCurrentRow["Amount"] = box7.Text; rowIndex++; } //add new row to DataTable dtCurrentTable.Rows.Add(drCurrentRow); //Store the current data to ViewState ViewState["OrderDetails"] = dtCurrentTable; //Rebind the Grid with the current data Gridview1.DataSource = dtCurrentTable; Gridview1.DataBind(); } } else { // } //Set Previous Data on Postbacks SetPreviousData(); } private void SetPreviousData() { int rowIndex = 0; if (ViewState["OrderDetails"] != null) { DataTable dt = (DataTable)ViewState["OrderDetails"]; if (dt.Rows.Count > 0) { for (int i = 1; i < dt.Rows.Count; i++) { TextBox box1 = (TextBox)Gridview1.Rows[rowIndex].Cells[1].FindControl("txtItemCode"); TextBox box2 = (TextBox)Gridview1.Rows[rowIndex].Cells[2].FindControl("txtdescription"); TextBox box3 = (TextBox)Gridview1.Rows[rowIndex].Cells[3].FindControl("txtunit"); TextBox box4 = (TextBox)Gridview1.Rows[rowIndex].Cells[4].FindControl("txtqty"); TextBox box5 = (TextBox)Gridview1.Rows[rowIndex].Cells[5].FindControl("txtRate"); TextBox box6 = (TextBox)Gridview1.Rows[rowIndex].Cells[6].FindControl("txtdisc"); TextBox box7 = (TextBox)Gridview1.Rows[rowIndex].Cells[7].FindControl("txtamount"); box1.Text = dt.Rows[i]["ItemCode"].ToString(); box2.Text = dt.Rows[i]["Description"].ToString(); box3.Text = dt.Rows[i]["Unit"].ToString(); box4.Text = dt.Rows[i]["Qty"].ToString(); box5.Text = dt.Rows[i]["Rate"].ToString(); box6.Text = dt.Rows[i]["Disc"].ToString(); box7.Text = dt.Rows[i]["Amount"].ToString(); rowIndex++; } dt.AcceptChanges(); } ViewState["OrderDetails"] = dt; } } protected void BindOrderDetails() { DataTable dtOrderDetails = new DataTable(); if (ViewState["OrderDetails"] != null) { dtOrderDetails = (DataTable)ViewState["OrderDetails"]; } else { dtOrderDetails.Columns.Add(""); dtOrderDetails.Columns.Add(""); dtOrderDetails.Columns.Add(""); dtOrderDetails.Columns.Add(""); dtOrderDetails.Columns.Add(""); dtOrderDetails.Columns.Add(""); dtOrderDetails.AcceptChanges(); DataRow dr = dtOrderDetails.NewRow(); dtOrderDetails.Rows.Add(dr); ViewState["OrderDetails"] = dtOrderDetails; } if (dtOrderDetails != null) { Gridview1.DataSource = dtOrderDetails; Gridview1.DataBind(); if (Gridview1.Rows.Count > 0) { ((LinkButton)Gridview1.Rows[Gridview1.Rows.Count - 1].FindControl("btnDelete")).Visible = false; } } } protected void btnSave_Click(object sender, EventArgs e) { if (txtOrderDate.Text != "" && txtOrderNo.Text != "" && txtPartyName.Text != "" && txttotalAmount.Text !="") { BLLOrderMaster bllobj = new BLLOrderMaster(); DataTable dtdetails = new DataTable(); UpdateItemDetailRow(); dtdetails = (DataTable)ViewState["OrderDetails"]; SetValues(bllobj); int k = 0; k = bllobj.Insert_Update_Delete(1, bllobj, dtdetails); if (k > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "Login Denied", "<Script>alert('Order Code Alraddy Exist');</Script>", false); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "Login Denied", "<Script>alert('Record Saved Successfully');</Script>", false); } dtdetails.Clear(); SetInitialRow(); txttotalAmount.Text = ""; txtOrderNo.Text = ""; txtPartyName.Text = ""; txtOrderDate.Text = ""; txttotalQty.Text = ""; string OrderNumber = objMaster.SelectDetails().ToString(); if (OrderNumber != "") { txtOrderNo.Text = OrderNumber.ToString(); txtOrderDate.Focus(); } } else { txtOrderNo.Text = ""; } } public void SetValues(BLLOrderMaster bllobj) { if (txtOrderNo.Text != null && txtOrderNo.Text.ToString() != "") { bllobj.OrNumber = Convert.ToInt16(txtOrderNo.Text); } if (txtOrderDate.Text != null && txtOrderDate.Text.ToString() != "") { bllobj.Date = DateTime.Parse(txtOrderDate.Text.ToString()).ToString("dd/MM/yyyy"); } if (txtPartyName.Text != null && txtPartyName.Text.ToString() != "") { bllobj.PartyName = txtPartyName.Text; } bllobj.TotalBillAmount = txttotalAmount.Text == "" ? 0 : int.Parse(txttotalAmount.Text); bllobj.TotalQty = txttotalQty.Text == "" ? 0 : int.Parse(txttotalQty.Text); } protected void txtdisc_TextChanged(object sender, EventArgs e) { double total = 0; double totalqty = 0; foreach (GridViewRow dgvr in Gridview1.Rows) { TextBox tb = (TextBox)dgvr.Cells[7].FindControl("txtamount"); double sum; if (double.TryParse(tb.Text.Trim(), out sum)) { total += sum; } TextBox tb1 = (TextBox)dgvr.Cells[4].FindControl("txtqty"); double qtysum; if (double.TryParse(tb1.Text.Trim(), out qtysum)) { totalqty += qtysum; } } txttotalAmount.Text = total.ToString(); txttotalQty.Text = totalqty.ToString(); AddNewRowToGrid(); Gridview1.TabIndex = 1; } public void UpdateItemDetailRow() { DataTable dt = new DataTable(); if (ViewState["OrderDetails"] != null) { dt = (DataTable)ViewState["OrderDetails"]; } if (dt.Rows.Count > 0) { for (int i = 0; i < Gridview1.Rows.Count; i++) { dt.Rows[i]["ItemCode"] = (Gridview1.Rows[i].FindControl("txtItemCode") as TextBox).Text.ToString(); if (dt.Rows[i]["ItemCode"].ToString() == "") { dt.Rows[i].Delete(); break; } else { dt.Rows[i]["Description"] = (Gridview1.Rows[i].FindControl("txtdescription") as TextBox).Text.ToString(); dt.Rows[i]["Unit"] = (Gridview1.Rows[i].FindControl("txtunit") as TextBox).Text.ToString(); dt.Rows[i]["Qty"] = (Gridview1.Rows[i].FindControl("txtqty") as TextBox).Text.ToString(); dt.Rows[i]["Rate"] = (Gridview1.Rows[i].FindControl("txtRate") as TextBox).Text.ToString(); dt.Rows[i]["Disc"] = (Gridview1.Rows[i].FindControl("txtdisc") as TextBox).Text.ToString(); dt.Rows[i]["Amount"] = (Gridview1.Rows[i].FindControl("txtamount") as TextBox).Text.ToString(); } } dt.AcceptChanges(); } ViewState["OrderDetails"] = dt; } }

    Read the article

  • Rows in their own columns depending on their date and simbolized by 'x'

    - by Chandradyani
    Dear All, please help me since I'm newbie in SQL Server. I have a select query that currently produces the following results: DoctorName Team Visit date dr. As A 5 dr. Sc A 4 dr. Gh B 6 dr. Nd C 31 dr As A 7 Using the following query: SELECT d.DoctorName, t.TeamName, ca.VisitDate FROM cActivity AS ca INNER JOIN doctor AS d ON ca.DoctorId = d.Id INNER JOIN team AS t ON ca.TeamId = t.Id WHERE ca.VisitDate BETWEEN '1/1/2010' AND '1/31/2010' I want to produce the following: DoctorName Team 1 2 3 4 5 6 7 ... 31 Visited dr. As A x x ... 2 times dr. Sc A x ... 1 times dr. Gh B x ... 1 times dr. Nd C ... X 1 times

    Read the article

  • Rows in their own columns depending on their date and symbolized by 'x'

    - by Chandradyani
    Dear All, please help me since I'm newbie in SQL Server. I have a select query that currently produces the following results: DoctorName Team Visit date dr. As A 5 dr. Sc A 4 dr. Gh B 6 dr. Nd C 31 dr As A 7 Using the following query: SELECT d.DoctorName, t.TeamName, ca.VisitDate FROM cActivity AS ca INNER JOIN doctor AS d ON ca.DoctorId = d.Id INNER JOIN team AS t ON ca.TeamId = t.Id WHERE ca.VisitDate BETWEEN '1/1/2010' AND '1/31/2010' I want to produce the following: DoctorName Team 1 2 3 4 5 6 7 ... 31 Visited dr. As A x x ... 2 times dr. Sc A x ... 1 times dr. Gh B x ... 1 times dr. Nd C ... X 1 times

    Read the article

  • VB.Net: exception on ExecuteReader() using OleDbCommand and Access

    - by Shane Fagan
    Hi again all, im getting the error below for this SQL statement in VB.Net 'Fill in the datagrid with the info needed from the accdb file 'to make it simple to access the db connstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data " connstring += "Source=" & Application.StartupPath & "\AuctioneerSystem.accdb" 'make the new connection conn = New System.Data.OleDb.OleDbConnection(connstring) 'the sql command SQLString = "SELECT AllPropertyDetails.PropertyID, Street, Town, County, Acres, Quotas, ResidenceDetails, Status, HighestBid, AskingPrice FROM AllPropertyDetails " SQLString += "INNER JOIN Land ON AllPropertyDetails.PropertyID = Land.PropertyID " SQLString += "WHERE Deleted = False " If PriceRadioButton.Checked = True Then SQLString += "ORDER BY AskingPrice ASC" ElseIf AcresRadioButton.Checked = True Then SQLString += "ORDER BY Acres ASC" End If 'try to open the connection conn.Open() 'if the connection is open If ConnectionState.Open.ToString = "Open" Then 'use the sqlstring and conn to create the command cmd = New System.Data.OleDb.OleDbCommand(SQLString, conn) 'read the db and put it into dr dr = cmd.ExecuteReader If dr.HasRows Then 'if there is rows in the db then make sure the list box is clear 'clear the rows and columns if there is rows in the data grid LandDataGridView.Rows.Clear() LandDataGridView.Columns.Clear() 'add the columns LandDataGridView.Columns.Add("PropertyNumber", "Property Number") LandDataGridView.Columns.Add("Address", "Address") LandDataGridView.Columns.Add("Acres", "No. of Acres") LandDataGridView.Columns.Add("Quotas", "Quotas") LandDataGridView.Columns.Add("Details", "Residence Details") LandDataGridView.Columns.Add("Status", "Status") LandDataGridView.Columns.Add("HighestBid", "Highest Bid") LandDataGridView.Columns.Add("Price", "Asking Price") While dr.Read 'output the fields into the data grid LandDataGridView.Rows.Add( _ dr.Item("PropertyID").ToString _ , dr.Item("Street").ToString & " " & dr.Item("Town").ToString & ", " & dr.Item("County").ToString _ , dr.Item("Acres").ToString _ , dr.Item("Quota").ToString _ , dr.Item("ResidenceDetails").ToString _ , dr.Item("Status").ToString _ , dr.Item("HighestBid").ToString _ , dr.Item("AskingPrice").ToString) End While End If 'close the data reader dr.Close() End If 'close the connection conn.Close() Any ideas why its not working? The fields in the DB and the table names seem ok but its not working :/ The tables are AllPropertyDetails ProperyID:Number Street: text Town: text County: text Status: text HighestBid: Currency AskingPrice: Currency Land PropertyID: Number Acres: Number Quotas: Text ResidenceDetails: text System.InvalidOperationException was unhandled Message="An error occurred creating the form. See Exception.InnerException for details. The error is: No value given for one or more required parameters." Source="AuctioneerProject" StackTrace: at AuctioneerProject.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190 at AuctioneerProject.My.MyProject.MyForms.get_LandReport() at AuctioneerProject.ReportsMenu.LandButton_Click(Object sender, EventArgs e) in C:\Users\admin\Desktop\Auctioneers\AuctioneerProject\AuctioneerProject\ReportsMenu.vb:line 4 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at AuctioneerProject.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.Data.OleDb.OleDbException ErrorCode=-2147217904 Message="No value given for one or more required parameters." Source="Microsoft Office Access Database Engine" StackTrace: at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteReader() at AuctioneerProject.LandReport.load_Land() in C:\Users\admin\Desktop\Auctioneers\AuctioneerProject\AuctioneerProject\LandReport.vb:line 37 at AuctioneerProject.LandReport.PriceRadioButton_CheckedChanged(Object sender, EventArgs e) in C:\Users\admin\Desktop\Auctioneers\AuctioneerProject\AuctioneerProject\LandReport.vb:line 79 at System.Windows.Forms.RadioButton.OnCheckedChanged(EventArgs e) at System.Windows.Forms.RadioButton.set_Checked(Boolean value) at AuctioneerProject.LandReport.InitializeComponent() in C:\Users\admin\Desktop\Auctioneers\AuctioneerProject\AuctioneerProject\LandReport.designer.vb:line 40 at AuctioneerProject.LandReport..ctor() in C:\Users\admin\Desktop\Auctioneers\AuctioneerProject\AuctioneerProject\LandReport.vb:line 5 InnerException:

    Read the article

  • Is there a way to catch assignments to or reads from an undefined property in the Spider-Monkey Java

    - by avri
    The Spider-Monkey JavaScript engine implements the noSuchMethod callback function for JavaScript Objects. This function is called whenever JavaScript tries to execute an undefined method of an Object. I would like to set a callback function to an Object that will be called whenever an undefined property in the Object is accessed or assigned to. I haven't found a noSuchProperty function implemented for JavaScript Objects and I am curios if there is any workaround that will achieve the same result.

    Read the article

  • Remove box2d bodies after collision deduction android?

    - by jubin
    Can any one explain me how to destroy box2d body when collide i have tried but my application crashed.First i have checked al collisions then add all the bodies in array who i want to destroy.I am trying to learning this tutorial My all the bodies are falling i want these bodies should destroy when these bodies will collide my actor monkey but when it collide it destroy but my aplication crashed.I have googled and from google i got the application crash reasons we should not destroy body in step funtion but i am removing body in the last of tick method. could any one help me or provide me code aur check my code why i am getting this prblem or how can i destroy box2d bodies. This is my code what i am doing. Please could any one check my code and tell me what is i am doing wrong for removing bodies. The code is for multiple box2d objects falling on my actor monkey it should be destroy when it will fall on the monkey.It is destroing but my application crahes. static class Box2DLayer extends CCLayer { protected static final float PTM_RATIO = 32.0f; protected static final float WALK_FACTOR = 3.0f; protected static final float MAX_WALK_IMPULSE = 0.2f; protected static final float ANIM_SPEED = 0.3f; int isLeft=0; String dir=""; int x =0; float direction; CCColorLayer objectHint; // protected static final float PTM_RATIO = 32.0f; protected World _world; protected static Body spriteBody; CGSize winSize = CCDirector.sharedDirector().winSize(); private static int count = 200; protected static Body monkey_body; private static Body bodies; CCSprite monkey; float animDelay; int animPhase; CCSpriteSheet danceSheet = CCSpriteSheet.spriteSheet("phases.png"); CCSprite _block; List<Body> toDestroy = new ArrayList<Body>(); //CCSpriteSheet _spriteSheet; private static MyContactListener _contactListener = new MyContactListener(); public Box2DLayer() { this.setIsAccelerometerEnabled(true); CCSprite bg = CCSprite.sprite("jungle.png"); addChild(bg,0); bg.setAnchorPoint(0,0); bg.setPosition(0,0); CGSize s = CCDirector.sharedDirector().winSize(); // Use scaled width and height so that our boundaries always match the current screen float scaledWidth = s.width/PTM_RATIO; float scaledHeight = s.height/PTM_RATIO; Vector2 gravity = new Vector2(0.0f, -30.0f); boolean doSleep = false; _world = new World(gravity, doSleep); // Create edges around the entire screen // Define the ground body. BodyDef bxGroundBodyDef = new BodyDef(); bxGroundBodyDef.position.set(0.0f, 0.0f); // The body is also added to the world. Body groundBody = _world.createBody(bxGroundBodyDef); // Register our contact listener // Define the ground box shape. PolygonShape groundBox = new PolygonShape(); Vector2 bottomLeft = new Vector2(0f,0f); Vector2 topLeft = new Vector2(0f,scaledHeight); Vector2 topRight = new Vector2(scaledWidth,scaledHeight); Vector2 bottomRight = new Vector2(scaledWidth,0f); // bottom groundBox.setAsEdge(bottomLeft, bottomRight); groundBody.createFixture(groundBox,0); // top groundBox.setAsEdge(topLeft, topRight); groundBody.createFixture(groundBox,0); // left groundBox.setAsEdge(topLeft, bottomLeft); groundBody.createFixture(groundBox,0); // right groundBox.setAsEdge(topRight, bottomRight); groundBody.createFixture(groundBox,0); CCSprite floorbg = CCSprite.sprite("grassbehind.png"); addChild(floorbg,1); floorbg.setAnchorPoint(0,0); floorbg.setPosition(0,0); CCSprite floorfront = CCSprite.sprite("grassfront.png"); floorfront.setTag(2); this.addBoxBodyForSprite(floorfront); addChild(floorfront,3); floorfront.setAnchorPoint(0,0); floorfront.setPosition(0,0); addChild(danceSheet); //CCSprite monkey = CCSprite.sprite(danceSheet, CGRect.make(0, 0, 48, 73)); //addChild(danceSprite); monkey = CCSprite.sprite("arms_up.png"); monkey.setTag(2); monkey.setPosition(200,100); BodyDef spriteBodyDef = new BodyDef(); spriteBodyDef.type = BodyType.DynamicBody; spriteBodyDef.bullet=true; spriteBodyDef.position.set(200 / PTM_RATIO, 300 / PTM_RATIO); monkey_body = _world.createBody(spriteBodyDef); monkey_body.setUserData(monkey); PolygonShape spriteShape = new PolygonShape(); spriteShape.setAsBox(monkey.getContentSize().width/PTM_RATIO/2, monkey.getContentSize().height/PTM_RATIO/2); FixtureDef spriteShapeDef = new FixtureDef(); spriteShapeDef.shape = spriteShape; spriteShapeDef.density = 2.0f; spriteShapeDef.friction = 0.70f; spriteShapeDef.restitution = 0.0f; monkey_body.createFixture(spriteShapeDef); //Vector2 force = new Vector2(10, 10); //monkey_body.applyLinearImpulse(force, spriteBodyDef.position); addChild(monkey,10000); this.schedule(tickCallback); this.schedule(createobjects, 2.0f); objectHint = CCColorLayer.node(ccColor4B.ccc4(255,0,0,128), 200f, 100f); addChild(objectHint, 15000); objectHint.setVisible(false); _world.setContactListener(_contactListener); } private UpdateCallback tickCallback = new UpdateCallback() { public void update(float d) { tick(d); } }; private UpdateCallback createobjects = new UpdateCallback() { public void update(float d) { secondUpdate(d); } }; private void secondUpdate(float dt) { this.addNewSprite(); } public void addBoxBodyForSprite(CCSprite sprite) { BodyDef spriteBodyDef = new BodyDef(); spriteBodyDef.type = BodyType.StaticBody; //spriteBodyDef.bullet=true; spriteBodyDef.position.set(sprite.getPosition().x / PTM_RATIO, sprite.getPosition().y / PTM_RATIO); spriteBody = _world.createBody(spriteBodyDef); spriteBody.setUserData(sprite); Vector2 verts[] = { new Vector2(-11.8f / PTM_RATIO, -24.5f / PTM_RATIO), new Vector2(11.7f / PTM_RATIO, -24.0f / PTM_RATIO), new Vector2(29.2f / PTM_RATIO, -14.0f / PTM_RATIO), new Vector2(28.7f / PTM_RATIO, -0.7f / PTM_RATIO), new Vector2(8.0f / PTM_RATIO, 18.2f / PTM_RATIO), new Vector2(-29.0f / PTM_RATIO, 18.7f / PTM_RATIO), new Vector2(-26.3f / PTM_RATIO, -12.2f / PTM_RATIO) }; PolygonShape spriteShape = new PolygonShape(); spriteShape.set(verts); //spriteShape.setAsBox(sprite.getContentSize().width/PTM_RATIO/2, //sprite.getContentSize().height/PTM_RATIO/2); FixtureDef spriteShapeDef = new FixtureDef(); spriteShapeDef.shape = spriteShape; spriteShapeDef.density = 2.0f; spriteShapeDef.friction = 0.70f; spriteShapeDef.restitution = 0.0f; spriteShapeDef.isSensor=true; spriteBody.createFixture(spriteShapeDef); } public void addNewSprite() { count=0; Random rand = new Random(); int Number = rand.nextInt(10); switch(Number) { case 0: _block = CCSprite.sprite("banana.png"); break; case 1: _block = CCSprite.sprite("backpack.png");break; case 2: _block = CCSprite.sprite("statue.png");break; case 3: _block = CCSprite.sprite("pineapple.png");break; case 4: _block = CCSprite.sprite("bananabunch.png");break; case 5: _block = CCSprite.sprite("hat.png");break; case 6: _block = CCSprite.sprite("canteen.png");break; case 7: _block = CCSprite.sprite("banana.png");break; case 8: _block = CCSprite.sprite("statue.png");break; case 9: _block = CCSprite.sprite("hat.png");break; } int padding=20; //_block.setPosition(CGPoint.make(100, 100)); // Determine where to spawn the target along the Y axis CGSize winSize = CCDirector.sharedDirector().displaySize(); int minY = (int)(_block.getContentSize().width / 2.0f); int maxY = (int)(winSize.width - _block.getContentSize().width / 2.0f); int rangeY = maxY - minY; int actualY = rand.nextInt(rangeY) + minY; // Create block and add it to the layer float xOffset = padding+_block.getContentSize().width/2+((_block.getContentSize().width+padding)*count); _block.setPosition(CGPoint.make(actualY, 750)); _block.setTag(1); float w = _block.getContentSize().width; objectHint.setVisible(true); objectHint.changeWidth(w); objectHint.setPosition(actualY-w/2, 460); this.addChild(_block,10000); // Create ball body and shape BodyDef ballBodyDef1 = new BodyDef(); ballBodyDef1.type = BodyType.DynamicBody; ballBodyDef1.position.set(actualY/PTM_RATIO, 480/PTM_RATIO); bodies = _world.createBody(ballBodyDef1); bodies.setUserData(_block); PolygonShape circle1 = new PolygonShape(); Vector2 verts[] = { new Vector2(-11.8f / PTM_RATIO, -24.5f / PTM_RATIO), new Vector2(11.7f / PTM_RATIO, -24.0f / PTM_RATIO), new Vector2(29.2f / PTM_RATIO, -14.0f / PTM_RATIO), new Vector2(28.7f / PTM_RATIO, -0.7f / PTM_RATIO), new Vector2(8.0f / PTM_RATIO, 18.2f / PTM_RATIO), new Vector2(-29.0f / PTM_RATIO, 18.7f / PTM_RATIO), new Vector2(-26.3f / PTM_RATIO, -12.2f / PTM_RATIO) }; circle1.set(verts); FixtureDef ballShapeDef1 = new FixtureDef(); ballShapeDef1.shape = circle1; ballShapeDef1.density = 10.0f; ballShapeDef1.friction = 0.0f; ballShapeDef1.restitution = 0.1f; bodies.createFixture(ballShapeDef1); count++; //Remove(); } @Override public void ccAccelerometerChanged(float accelX, float accelY, float accelZ) { //Apply the directional impulse /*float impulse = monkey_body.getMass()*accelY*WALK_FACTOR; Vector2 force = new Vector2(impulse, 0); monkey_body.applyLinearImpulse(force, monkey_body.getWorldCenter());*/ walk(accelY); //Remove(); } private void walk(float accelY) { // TODO Auto-generated method stub direction = accelY; } private void Remove() { for (Iterator<MyContact> it1 = _contactListener.mContacts.iterator(); it1.hasNext();) { MyContact contact = it1.next(); Body bodyA = contact.fixtureA.getBody(); Body bodyB = contact.fixtureB.getBody(); // See if there's any user data attached to the Box2D body // There should be, since we set it in addBoxBodyForSprite if (bodyA.getUserData() != null && bodyB.getUserData() != null) { CCSprite spriteA = (CCSprite) bodyA.getUserData(); CCSprite spriteB = (CCSprite) bodyB.getUserData(); // Is sprite A a cat and sprite B a car? If so, push the cat // on a list to be destroyed... if (spriteA.getTag() == 1 && spriteB.getTag() == 2) { //Log.v("dsfds", "dsfsd"+bodyA); //_world.destroyBody(bodyA); // removeChild(spriteA, true); toDestroy.add(bodyA); } // Is sprite A a car and sprite B a cat? If so, push the cat // on a list to be destroyed... else if (spriteA.getTag() == 2 && spriteB.getTag() == 1) { //Log.v("dsfds", "dsfsd"+bodyB); toDestroy.add(bodyB); } } } // Loop through all of the box2d bodies we want to destroy... for (Iterator<Body> it1 = toDestroy.iterator(); it1.hasNext();) { Body body = it1.next(); // See if there's any user data attached to the Box2D body // There should be, since we set it in addBoxBodyForSprite if (body.getUserData() != null) { // We know that the user data is a sprite since we set // it that way, so cast it... CCSprite sprite = (CCSprite) body.getUserData(); // Remove the sprite from the scene _world.destroyBody(body); removeChild(sprite, true); } // Destroy the Box2D body as well // _contactListener.mContacts.remove(0); } } public synchronized void tick(float delta) { synchronized (_world) { _world.step(delta, 8, 3); //_world.clearForces(); //addNewSprite(); } CCAnimation danceAnimation = CCAnimation.animation("dance", 1.0f); // Iterate over the bodies in the physics world Iterator<Body> it = _world.getBodies(); while(it.hasNext()) { Body b = it.next(); Object userData = b.getUserData(); if (userData != null && userData instanceof CCSprite) { //Synchronize the Sprites position and rotation with the corresponding body CCSprite sprite = (CCSprite)userData; if(sprite.getTag()==1) { //b.applyLinearImpulse(force, pos); sprite.setPosition(b.getPosition().x * PTM_RATIO, b.getPosition().y * PTM_RATIO); sprite.setRotation(-1.0f * ccMacros.CC_RADIANS_TO_DEGREES(b.getAngle())); } else { //Apply the directional impulse float impulse = monkey_body.getMass()*direction*WALK_FACTOR; Vector2 force = new Vector2(impulse, 0); b.applyLinearImpulse(force, b.getWorldCenter()); sprite.setPosition(b.getPosition().x * PTM_RATIO, b.getPosition().y * PTM_RATIO); animDelay -= 1.0f/60.0f; if(animDelay <= 0) { animDelay = ANIM_SPEED; animPhase++; if(animPhase > 2) { animPhase = 1; } } if(direction < 0 ) { isLeft=1; } else { isLeft=0; } if(isLeft==1) { dir = "left"; } else { dir = "right"; } float standingLimit = (float) 0.1f; float vX = monkey_body.getLinearVelocity().x; if((vX > -standingLimit)&& (vX < standingLimit)) { // Log.v("sasd", "standing"); } else { } } } } Remove(); } } Sorry for my english. Thanks in advance.

    Read the article

  • Optimize inserts

    - by ikerib
    Hi! I did an importer in VB .Net witch get data from an SQLServer an inserts this data throught ADSL connection in a remote MySQL server. in the first time, it was like 200 records, but now there are more than 500.000 records and it expends like 11hours exporting all the data and that is bad, veryyy bad. I need to optimize my importer, witch now gets the data into a datatable an them i have a function witch with a loop (row to row) inserts the data with a "insert into" query... like this: For Each dr As DataRow In dt.Rows Console.Write(".") Dim sql As String = "INSERT INTO clientes(id,nombrefis,nombrecom,direccion,codpos,municipio_id,telefono,fax,cif)" & _ "VALUES (@id,@nombrefis,@nombrecom,@direccion,@codpos,@municipio_id,@telefono,@fax,@cif)" cmd = New MySqlCommand(sql, cnn) cmd.Parameters.AddWithValue("id", Int32.Parse(dr("ID EMPRESA").ToString)) cmd.Parameters.AddWithValue("nombrefis", dr("NOMEMP")) cmd.Parameters.AddWithValue("nombrecom", dr("EMPRESA")) cmd.Parameters.AddWithValue("direccion", dr("DIRECC")) cmd.Parameters.AddWithValue("codpos", dr("CODPOS")) cmd.Parameters.AddWithValue("municipio_id", Int32.Parse(dr("CODIGO MUNICIPIO")).ToString) cmd.Parameters.AddWithValue("telefono", dr("TELEF")) cmd.Parameters.AddWithValue("fax", dr("FAX")) cmd.Parameters.AddWithValue("cif", dr("CIF")) cmd.ExecuteNonQuery() Next any ideas or advices? thanks so much

    Read the article

  • ASP.NET MVC & EF4 Entity Framework - Are there any performance concerns in using the entities vs retrieving only the fields i need?

    - by Ant
    Lets say we have 3 tables, Users, Products, Purchases. There is a view that needs to display the purchases made by a user. I could lookup the data required by doing: from p in DBSet<Purchases>.Include("User").Include("Product") select p; However, I am concern that this may have a performance impact because it will retrieve the full objects. Alternatively, I could select only the fields i need: from p in DBSet<Purchases>.Include("User").Include("Product") select new SimplePurchaseInfo() { UserName = p.User.name, Userid = p.User.Id, ProductName = p.Product.Name ... etc }; So my question is: Whats the best practice in doing this? == EDIT Thanks for all the replies. [QUESTION 1]: I want to know whether all views should work with flat ViewModels with very specific data for that view, or should the ViewModels contain the entity objects. Real example: User reviews Products var query = from dr in productRepository.FindAllReviews() where dr.User.UserId = 'userid' select dr; string sql = ((ObjectQuery)query).ToTraceString(); SELECT [Extent1].[ProductId] AS [ProductId], [Extent1].[Comment] AS [Comment], [Extent1].[CreatedTime] AS [CreatedTime], [Extent1].[Id] AS [Id], [Extent1].[Rating] AS [Rating], [Extent1].[UserId] AS [UserId], [Extent3].[CreatedTime] AS [CreatedTime1], [Extent3].[CreatorId] AS [CreatorId], [Extent3].[Description] AS [Description], [Extent3].[Id] AS [Id1], [Extent3].[Name] AS [Name], [Extent3].[Price] AS [Price], [Extent3].[Rating] AS [Rating1], [Extent3].[ShopId] AS [ShopId], [Extent3].[Thumbnail] AS [Thumbnail], [Extent3].[Creator_UserId] AS [Creator_UserId], [Extent4].[Comment] AS [Comment1], [Extent4].[DateCreated] AS [DateCreated], [Extent4].[DateLastActivity] AS [DateLastActivity], [Extent4].[DateLastLogin] AS [DateLastLogin], [Extent4].[DateLastPasswordChange] AS [DateLastPasswordChange], [Extent4].[Email] AS [Email], [Extent4].[Enabled] AS [Enabled], [Extent4].[PasswordHash] AS [PasswordHash], [Extent4].[PasswordSalt] AS [PasswordSalt], [Extent4].[ScreenName] AS [ScreenName], [Extent4].[Thumbnail] AS [Thumbnail1], [Extent4].[UserId] AS [UserId1], [Extent4].[UserName] AS [UserName] FROM [ProductReviews] AS [Extent1] INNER JOIN [Users] AS [Extent2] ON [Extent1].[UserId] = [Extent2].[UserId] LEFT OUTER JOIN [Products] AS [Extent3] ON [Extent1].[ProductId] = [Extent3].[Id] LEFT OUTER JOIN [Users] AS [Extent4] ON [Extent1].[UserId] = [Extent4].[UserId] WHERE N'615005822' = [Extent2].[UserId] or from d in productRepository.FindAllProducts() from dr in d.ProductReviews where dr.User.UserId == 'userid' orderby dr.CreatedTime select new ProductReviewInfo() { product = new SimpleProductInfo() { Id = d.Id, Name = d.Name, Thumbnail = d.Thumbnail, Rating = d.Rating }, Rating = dr.Rating, Comment = dr.Comment, UserId = dr.UserId, UserScreenName = dr.User.ScreenName, UserThumbnail = dr.User.Thumbnail, CreateTime = dr.CreatedTime }; SELECT [Extent1].[Id] AS [Id], [Extent1].[Name] AS [Name], [Extent1].[Thumbnail] AS [Thumbnail], [Extent1].[Rating] AS [Rating], [Extent2].[Rating] AS [Rating1], [Extent2].[Comment] AS [Comment], [Extent2].[UserId] AS [UserId], [Extent4].[ScreenName] AS [ScreenName], [Extent4].[Thumbnail] AS [Thumbnail1], [Extent2].[CreatedTime] AS [CreatedTime] FROM [Products] AS [Extent1] INNER JOIN [ProductReviews] AS [Extent2] ON [Extent1].[Id] = [Extent2].[ProductId] INNER JOIN [Users] AS [Extent3] ON [Extent2].[UserId] = [Extent3].[UserId] LEFT OUTER JOIN [Users] AS [Extent4] ON [Extent2].[UserId] = [Extent4].[UserId] WHERE N'userid' = [Extent3].[UserId] ORDER BY [Extent2].[CreatedTime] ASC [QUESTION 2]: Whats with the ugly outer joins?

    Read the article

  • How do I step through and debug a Scheme program using Dr. Racket?

    - by Thomas Owens
    I'm using the Dr. Racket development environment and the language definition #lang scheme to do work for a course. However, I'm not sure how to best use this tool for debugging. I would like to be able to execute a function and step through it, observing the values of different functions at various points in execution. Is this possible? If not, what is the typical method of stepping through the execution of a Scheme program and debugging it?

    Read the article

  • Is there a way to disable all other Java Scripts other than my own with Grease Monkey

    - by DKinzer
    I need help getting a Grease Monkey with JQuery Script to run on a broken site. I'm trying to get the following GM script to run, but the page I want it to work on has a JS error and my JS does not get executed. // ==UserScript== // @name BILL INFO PAGE ALTER // @namespace http://jenkinslaw.org // @description Alter the web page in order to pretty print // @include http://www.legis.state.pa.us/cfdocs/billinfo/bill_history.cfm?* // @require http://code.jquery.com/jquery-1.4.2.min.js // ==/UserScript== */ (function() { //Make a copy of the bill table var bill_table = $('.main_table').clone(); //empty the whole lot $(body).empty(); //append the bill back to the dom. $(body).append(bill_table); }()); Thanks! D

    Read the article

  • Postback Removing Styling from Page

    - by Roy
    Hi, Currently I've created a ASP.Net page that has a dropdown control with autopostback set to true. I've also added color backgrounds for individual listitems. Whenever an item is selected in the dropdown control the styling is completely removed from all of the list items. How can I prevent this from happening? I need the postback to pull data based on the dropdown item that is selected. Here is my code. aspx file: <asp:DropDownList ID="EmpDropDown" AutoPostBack="True" OnSelectedIndexChanged="EmpDropDown_SelectedIndexChanged" runat="server"> </asp:DropDownList> <asp:TextBox ID="MessageTextBox" TextMode="MultiLine" Width="550" Height="100px" runat="server"></asp:TextBox> aspx.cs code behind: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GetEmpList(); } } protected void EmpDropDown_SelectedIndexChanged(object sender, EventArgs e) { GetEmpDetails(); } private void GetEmpList() { SqlDataReader dr = ToolsLayer.GetEmpList(); int currentIndex = 0; while (dr.Read()) { EmpDropDown.Items.Add(new ListItem(dr["Title"].ToString(), dr["EmpKey"].ToString())); if (dr["Status"].ToString() == "disabled") { EmpDropDown.Items[currentIndex].Attributes.Add("style", "background-color:red;"); } currentIndex++; } dr.Close(); } private void GetEmpDetails() { SqlDataReader dr = ToolsLayer.GetEmpDetails(EmpDropDown.SelectedValue); while (dr.Read()) { MessageTextBox.Text = dr["Message"].ToString(); } dr.Close(); } Thank You

    Read the article

  • How do I compare two datatables

    - by cmrhema
    I have a datatable that will consist of 72 columns. I will download it in the excel sheet using VSTO, which works fine. Now the user will change either one of these rows or all of these rows and will also insert a fresh row. Considering the datatable downloaded first to be dtA, and the one that has been modified in the excel sheet to be dtB. I want to compare dtA and dtB. I need to find out all the rows in dtB that do not exist in dtA. I cant put foreach loop for each and every single row and evaluate as its a very untidy way of coding. What is a better way to do this? I did this way, DataTable dtA = new DataTable(); dtA.Columns.Add("ENo"); dtA.Columns.Add("ENo1"); dtA.Columns.Add("ENo2"); dtA.Columns.Add("ENo3"); dtA.Columns.Add("ENo4"); for (int i = 0; i < 5; i++) { DataRow dr = dtA.NewRow(); dr[0] = "Part 0 " + i.ToString(); dr[1] = "Part 1 " + i.ToString(); dr[2] = "Part 2 " + i.ToString(); dr[3] = "Part 3 " + i.ToString(); dr[4] = "Part 4 " + i.ToString(); dtA.Rows.Add(dr); } DataTable dtB = new DataTable(); dtB.Columns.Add("ENo"); dtB.Columns.Add("ENo1"); dtB.Columns.Add("ENo2"); dtB.Columns.Add("ENo3"); dtB.Columns.Add("ENo4"); for (int i = 5; i < 10; i++) { DataRow dr = dtB.NewRow(); dr[0] = "Part 0 " + i.ToString(); dr[1] = "Part 1 " + i.ToString(); dr[2] = "Part 2 " + i.ToString(); dr[3] = "Part 3 " + i.ToString(); dr[4] = "Part 4 " + i.ToString(); dtB.Rows.Add(dr); } Response.Write("\n"); Response.Write("dt A"); Response.Write("\n"); for (int i = 0; i < dtA.Rows.Count; i++) { Response.Write(dtA.Rows[i][i].ToString()); Response.Write("\n"); } Response.Write("\n"); Response.Write("dt B"); Response.Write("\n"); for (int i = 0; i < dtB.Rows.Count; i++) { Response.Write(dtB.Rows[i][i].ToString()); Response.Write("\n"); } var VarA = dtA.AsEnumerable(); var varB = dtA.AsEnumerable(); var diff = VarA.Except(varB); Response.Write("except"); foreach (var n in diff) { Response.Write(n.Table.Rows[0].ToString()); } But I do not know what to use in the foreach var, What should I use pls?

    Read the article

  • Session variable gets updated automatically

    - by user1869914
    protected void btningAccept_Click(object sender, EventArgs e) { if(!(txtLOVCode.Text==" "||txtLOVvalue.Text==" ")) { rowid++; // DFDLOVlst.Visible=true; DataTable dt = createTemptable(); dt = (DataTable)Session["dfdtemptable"]; DataRow dr = dt.NewRow(); dr["prociLOV_Id"] = rowid; dr["prociLOV_Value"] = txtLOVvalue.Text; dr["prociLOV_Code"] = txtLOVCode.Text; Boolean isalreadyinLOVlst = false; foreach (DataRow chkrow in dt.Rows) { if (String.Equals(dr["prociLOV_Value"].ToString().Trim(), chkrow["prociLOV_Value"].ToString().Trim(),StringComparison.CurrentCultureIgnoreCase) && String.Equals(dr["prociLOV_Code"].ToString().Trim(), chkrow["prociLOV_Code"].ToString().Trim(), StringComparison.CurrentCultureIgnoreCase)) { isalreadyinLOVlst = true; break; } } if (isalreadyinLOVlst) { this.lblMessage.Text = "LOV value: " + dr["prociLOV_Value"].ToString() + ": " + dr["prociLOV_Code"].ToString() + " already exits"; } else { this.lblMessage.Text = " "; dt.Rows.Add(dr); DataTable addedLOV = createTemptable(); addedLOV = (DataTable)Session["addedLOV"]; addedLOV.ImportRow(dr); ; Session["addedLOV"] = addedLOV; } DFDLOVlst.DataSource = dt; DFDLOVlst.DataBind(); // dt.AcceptChanges(); Session["dfdtemptable"] = dt; txtLOVCode.Text = ""; txtLOVvalue.Text = ""; MDIngrdientsCode.Hide(); this.txtLOVvalue.ReadOnly = false; this.txtLOVCode.ReadOnly = false; } else this.lblMessage.Text="NO LOV VALUES ENTERED"; } Here the session varible Session["dfdtemptable"] and Session["addedLOV"] both gets updated twice and their row count becomes 2 for each session varible..But the row count sholud be 1 for each session varible.But the Session variable gets updated on the other Session varibles updation.. The Session["dfdtemptable"] gets updated when Session["addedLOV"] is assigned or updated..Can't figure out the problem..?

    Read the article

  • Mac OS X - rmdir fails with "Operation not permitted" for a folder created by a PC on a removable dr

    - by maxint
    Hello. I have a problem (using Mac OS X 10.5.8) with the access rights of a folder that was presumably created by a virus on a disk-on-key drive when I used it with a PC. I can't remove the folder or change it's name. In Finder's Info window the Lock box is unchecked and uncheckable - if I try to check it it flips back to off. Please see the details: MaxBookAir:GARMIN'S maxint$ rmdir winamp_cache_0001/ rmdir: winamp_cache_0001/: Operation not permitted MaxBookAir:GARMIN'S maxint$ MaxBookAir:GARMIN'S maxint$ mv winamp_cache_0001 test mv: rename winamp_cache_0001 to test: Operation not permitted MaxBookAir:GARMIN'S maxint$ MaxBookAir:GARMIN'S maxint$ GetFileInfo winamp_cache_0001 directory: "/Volumes/GARMIN'S/winamp_cache_0001" attributes: avbstclinmedz created: 12/23/2009 14:34:52 modified: 02/13/2010 22:52:36 MaxBookAir:GARMIN'S maxint$ MaxBookAir:GARMIN'S maxint$ stat -x winamp_cache_0001 File: "winamp_cache_0001" Size: 32768 FileType: Directory Mode: (0777/drwxrwxrwx) Uid: ( 502/ maxint) Gid: ( 20/ staff) Device: 14,5 Inode: 7439 Links: 1 Access: Wed Dec 23 00:00:00 2009 Modify: Sat Feb 13 22:52:36 2010 Change: Sat Feb 13 22:52:36 2010 MaxBookAir:GARMIN'S maxint$ MaxBookAir:GARMIN'S maxint$ stat -r winamp_cache_0001 234881029 7439 040777 1 502 20 0 32768 1261506600 1266081756 1266081756 1261559092 131072 64 32768 winamp_cache_0001 MaxBookAir:GARMIN'S maxint$ MaxBookAir:GARMIN'S maxint$ ls -lTd winamp_cache_0001/ drwxrwxrwx 1 maxint staff 32768 Feb 13 22:52:36 2010 winamp_cache_0001/ MaxBookAir:GARMIN'S maxint$

    Read the article

  • Exception on ExecuteReader() using OleDbCommand and Access

    - by Shane Fagan
    Hi again all, I'm getting the error below for this SQL statement in VB.Net 'Fill in the datagrid with the info needed from the accdb file 'to make it simple to access the db connstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data " connstring += "Source=" & Application.StartupPath & "\AuctioneerSystem.accdb" 'make the new connection conn = New System.Data.OleDb.OleDbConnection(connstring) 'the sql command SQLString = "SELECT AllPropertyDetails.PropertyID, Street, Town, County, Acres, Quotas, ResidenceDetails, Status, HighestBid, AskingPrice FROM AllPropertyDetails " SQLString += "INNER JOIN Land ON AllPropertyDetails.PropertyID = Land.PropertyID " SQLString += "WHERE Deleted = False " If PriceRadioButton.Checked = True Then SQLString += "ORDER BY AskingPrice ASC" ElseIf AcresRadioButton.Checked = True Then SQLString += "ORDER BY Acres ASC" End If 'try to open the connection conn.Open() 'if the connection is open If ConnectionState.Open.ToString = "Open" Then 'use the sqlstring and conn to create the command cmd = New System.Data.OleDb.OleDbCommand(SQLString, conn) 'read the db and put it into dr dr = cmd.ExecuteReader If dr.HasRows Then 'if there is rows in the db then make sure the list box is clear 'clear the rows and columns if there is rows in the data grid LandDataGridView.Rows.Clear() LandDataGridView.Columns.Clear() 'add the columns LandDataGridView.Columns.Add("PropertyNumber", "Property Number") LandDataGridView.Columns.Add("Address", "Address") LandDataGridView.Columns.Add("Acres", "No. of Acres") LandDataGridView.Columns.Add("Quotas", "Quotas") LandDataGridView.Columns.Add("Details", "Residence Details") LandDataGridView.Columns.Add("Status", "Status") LandDataGridView.Columns.Add("HighestBid", "Highest Bid") LandDataGridView.Columns.Add("Price", "Asking Price") While dr.Read 'output the fields into the data grid LandDataGridView.Rows.Add( _ dr.Item("PropertyID").ToString _ , dr.Item("Street").ToString & " " & dr.Item("Town").ToString & ", " & dr.Item("County").ToString _ , dr.Item("Acres").ToString _ , dr.Item("Quota").ToString _ , dr.Item("ResidenceDetails").ToString _ , dr.Item("Status").ToString _ , dr.Item("HighestBid").ToString _ , dr.Item("AskingPrice").ToString) End While End If 'close the data reader dr.Close() End If 'close the connection conn.Close() Any ideas why its not working? The fields in the DB and the table names seem ok but its not working :/ The tables are AllPropertyDetails ProperyID:Number Street: text Town: text County: text Status: text HighestBid: Currency AskingPrice: Currency Deleted: Boolean Land PropertyID: Number Acres: Number Quotas: Text ResidenceDetails: text error is: System.InvalidOperationException was unhandled Message="An error occurred creating the form. See Exception.InnerException for details. The error is: No value given for one or more required parameters." Source="AuctioneerProject" StackTrace: at AuctioneerProject.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190 at AuctioneerProject.My.MyProject.MyForms.get_LandReport() at AuctioneerProject.ReportsMenu.LandButton_Click(Object sender, EventArgs e) in C:\Users\admin\Desktop\Auctioneers\AuctioneerProject\AuctioneerProject\ReportsMenu.vb:line 4 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at AuctioneerProject.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.Data.OleDb.OleDbException ErrorCode=-2147217904 Message="No value given for one or more required parameters." Source="Microsoft Office Access Database Engine" StackTrace: at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteReader() at AuctioneerProject.LandReport.load_Land() in C:\Users\admin\Desktop\Auctioneers\AuctioneerProject\AuctioneerProject\LandReport.vb:line 37 at AuctioneerProject.LandReport.PriceRadioButton_CheckedChanged(Object sender, EventArgs e) in C:\Users\admin\Desktop\Auctioneers\AuctioneerProject\AuctioneerProject\LandReport.vb:line 79 at System.Windows.Forms.RadioButton.OnCheckedChanged(EventArgs e) at System.Windows.Forms.RadioButton.set_Checked(Boolean value) at AuctioneerProject.LandReport.InitializeComponent() in C:\Users\admin\Desktop\Auctioneers\AuctioneerProject\AuctioneerProject\LandReport.designer.vb:line 40 at AuctioneerProject.LandReport..ctor() in C:\Users\admin\Desktop\Auctioneers\AuctioneerProject\AuctioneerProject\LandReport.vb:line 5 InnerException:

    Read the article

  • Selecting first instance of class but not nested instances via jQuery

    - by DA
    Given the following hypothetical markup: <ul class="monkey"> <li> <p class="horse"></p> <p class="cow"></p> </li> </ul> <dl class="monkey"> <dt class="horse"></dt> <dd class="cow"> <dl> <dt></dt> <dd></dd> </dl> <dl class="monkey"> <dt class="horse"></dt> <dd class="cow"></dd> </dl> </dd> </dl> I want to be able to grab the 'first level' of horse and cow classes within each monkey class. But I don't want the NESTED horse and cow classes. I started with .children, but that won't work with the UL example as they aren't direct children of .monkey. I can use find: $('.monkey').find('.horse, .cow') but that returns all instances, including the nested ones. I can filter the find: $('.monkey').find('.horse, .cow').not('.cow .horse, .cow .cow') but that prevents me from selecting nested instances on a second function call. So...I guess what I'm looking for is 'find first "level" of this descendant'. I could likely do this with some looping logic, but was wondering if there is a selector and/or some combo of selectors that would achieve that logic.

    Read the article

  • Can a Generic Method handle both Reference and Nullable Value types?

    - by Adam Lassek
    I have a series of Extension methods to help with null-checking on IDataRecord objects, which I'm currently implementing like this: public static int? GetNullableInt32(this IDataRecord dr, int ordinal) { int? nullInt = null; return dr.IsDBNull(ordinal) ? nullInt : dr.GetInt32(ordinal); } public static int? GetNullableInt32(this IDataRecord dr, string fieldname) { int ordinal = dr.GetOrdinal(fieldname); return dr.GetNullableInt32(ordinal); } and so on, for each type I need to deal with. I'd like to reimplement these as a generic method, partly to reduce redundancy and partly to learn how to write generic methods in general. I've written this: public static Nullable<T> GetNullable<T>(this IDataRecord dr, int ordinal) { Nullable<T> nullValue = null; return dr.IsDBNull(ordinal) ? nullValue : (Nullable<T>) dr.GetValue(ordinal); } which works as long as T is a value type, but if T is a reference type it won't. This method would need to return either a Nullable type if T is a value type, and default(T) otherwise. How would I implement this behavior?

    Read the article

  • im unable to validate a login of users ,since if im entering the wrong values my datareader is not getting executed y ?

    - by Salman_Khan
    //code private void glassButton1_Click(object sender, EventArgs e) { if (textBox1.Text == "" || textBox1.Text == "" || comboBox1.SelectedIndex == 0) { Message m = new Message(); m.ShowDialog(); } else { try { con.ConnectionString = "Data source=BLACK-PEARL;Initial Catalog=LIFELINE ;User id =sa; password=143"; con.Open(); SqlCommand cmd = new SqlCommand("Select LoginID,Password,Department from Login where LoginID=@loginID and Password=@Password and Department=@Department", con); cmd.Parameters.Add(new SqlParameter("@loginID", textBox1.Text)); cmd.Parameters.Add(new SqlParameter("@Password", textBox2.Text)); cmd.Parameters.Add(new SqlParameter("@Department", comboBox1.Text)); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { string Strname = dr[0].ToString(); string StrPass = dr[1].ToString(); string StrDept = dr[2].ToString(); if(dr[2].ToString().Equals(comboBox1.Text)&&dr[0].ToString().Equals(textBox1.Text)&&dr[1].ToString().Equals(textBox2.Text)) { MessageBox.Show("Welcome"); } else { MessageBox.Show("Please Enter correct details"); } } dr.Close(); } catch (Exception ex) { MessageBox.Show("Exception" + ex); } finally { con.Close(); } } }

    Read the article

  • C# ASP.NET AJAX CascadingDropDown Selected value propriety problem

    - by Eyla
    Greetings, I have a problem to use selected value propriety of CascadingDropDown. I have 3 asp dropdown controls with ajax CascadingDropDown for each one of them. I have no problem to bind data to the 3 CascadingDropDown but my problem is to rebind CascadingDropDown. simply what I want to do is to select a record from Gridview which has the selected values for the CascadingDropDown that I want to pass then rebind the CascadingDropDown with selected value. I'm posting my code down which include: 1-ASP.NET code. 2-Code behind to handle selected record from grid view. 3- web servisice that handle binding data to the 3 CascadingDropDown. please advice how to rebind data to CascadingDropDown with selected value. by the way I used selected value proprety as showning in my code but it is not working and there is no error. Thank you, ........................ ASP.NET code ........................ <%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="IMAM_APPLICATION.WebForm1" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="idcontact_info" DataSourceID="ObjectDataSource1" onselectedindexchanged="GridView1_SelectedIndexChanged"> <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="idcontact_info" HeaderText="idcontact_info" InsertVisible="False" ReadOnly="True" SortExpression="idcontact_info" /> <asp:BoundField DataField="Work_Field" HeaderText="Work_Field" SortExpression="Work_Field" /> <asp:BoundField DataField="Occupation" HeaderText="Occupation" SortExpression="Occupation" /> <asp:BoundField DataField="sub_Occupation" HeaderText="sub_Occupation" SortExpression="sub_Occupation" /> </Columns> </asp:GridView> <asp:Label ID="lbl" runat="server" Text="Label"></asp:Label> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="IMAM_APPLICATION.DSContactTableAdapters.contact_infoTableAdapter" UpdateMethod="Update"> <DeleteParameters> <asp:Parameter Name="Original_idcontact_info" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="Work_Field" Type="String" /> <asp:Parameter Name="Occupation" Type="String" /> <asp:Parameter Name="sub_Occupation" Type="String" /> <asp:Parameter Name="Original_idcontact_info" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="Work_Field" Type="String" /> <asp:Parameter Name="Occupation" Type="String" /> <asp:Parameter Name="sub_Occupation" Type="String" /> </InsertParameters> </asp:ObjectDataSource> <asp:DropDownList ID="cmbWorkField" runat="server" Style="top: 715px; left: 180px; position: absolute; height: 22px; width: 126px"> </asp:DropDownList> <asp:DropDownList runat="server" ID="cmbOccupation" Style="top: 745px; left: 180px; position: absolute; height: 22px; width: 77px"> </asp:DropDownList> <asp:DropDownList ID="cmbSubOccup" runat="server" style="position:absolute; top: 775px; left: 180px;"> </asp:DropDownList> <cc1:CascadingDropDown ID="cmbWorkField_CascadingDropDown" runat="server" TargetControlID="cmbWorkField" Category="WorkField" LoadingText="Please Wait ..." PromptText="Select Wor kField ..." ServiceMethod="GetWorkField" ServicePath="ServiceTags.asmx"> </cc1:CascadingDropDown> <cc1:CascadingDropDown ID="cmbOccupation_CascadingDropDown" runat="server" TargetControlID="cmbOccupation" Category="Occup" LoadingText="Please wait..." PromptText="Select Occup ..." ServiceMethod="GetOccup" ServicePath="ServiceTags.asmx" ParentControlID="cmbWorkField"> </cc1:CascadingDropDown> <cc1:CascadingDropDown ID="cmbSubOccup_CascadingDropDown" runat="server" Category="SubOccup" Enabled="True" LoadingText="Please Wait..." ParentControlID="cmbOccupation" PromptText="Select Sub Occup" ServiceMethod="GetSubOccup" ServicePath="ServiceTags.asmx" TargetControlID="cmbSubOccup"> </cc1:CascadingDropDown> </asp:Content> ...................................................... C# code behind ...................................................... protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { string strg = GridView1.SelectedDataKey["idcontact_info"].ToString(); int index = Convert.ToInt32(GridView1.SelectedDataKey["idcontact_info"].ToString()); //txtSearch.Text = GridView1.SelectedIndex.ToString(); // txtSearch.Text = GridView1.SelectedDataKey["idcontact_info"].ToString(); DSContactTableAdapters.contact_infoTableAdapter GetByIDAdapter = new DSContactTableAdapters.contact_infoTableAdapter(); DSContact.contact_infoDataTable ByID = GetByIDAdapter.GetDataByID(index); //DSSearch.contact_infoDataTable FirstName = FirstNameAdapter.GetDataByFirstNameList(prefixText); foreach (DataRow dr in ByID.Rows) { lbl.Text = dr["Work_Field"].ToString() + "....." + dr["Occupation"].ToString() + "....." + dr["sub_Occupation"].ToString(); cmbWorkField_CascadingDropDown.SelectedValue = dr["Work_Field"].ToString(); cmbOccupation_CascadingDropDown.SelectedValue = dr["Occupation"].ToString(); cmbSubOccup_CascadingDropDown.SelectedValue = dr["sub_Occupation"].ToString(); } } ....................................................... web Service ....................................................... [WebMethod] public CascadingDropDownNameValue[] GetWorkField(string knownCategoryValues, string category) { //dsCarsTableAdapters.CarsTableAdapter makeAdapter = new dsCarsTableAdapters.CarsTableAdapter(); //dsCars.CarsDataTable makes = makeAdapter.GetAllCars(); DSContactTableAdapters.tag_work_fieldTableAdapter GetWorkFieldAdapter = new DSContactTableAdapters.tag_work_fieldTableAdapter(); DSContact.tag_work_fieldDataTable WorkFields = GetWorkFieldAdapter.GetDataByGetWorkField(); List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>(); foreach (DataRow dr in WorkFields) { string Work_Field = (string)dr["work_Field_name"]; int idtag_work_field = (int)dr["idtag_work_field"]; values.Add(new CascadingDropDownNameValue(Work_Field, idtag_work_field.ToString())); } return values.ToArray(); } [WebMethod] public CascadingDropDownNameValue[] GetOccup(string knownCategoryValues, string category) { StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); int idtag_work_field; if (!kv.ContainsKey("WorkField") || !Int32.TryParse(kv["WorkField"], out idtag_work_field)) { return null; } //dsCarModelsTableAdapters.CarModelsTableAdapter modelAdapter = new dsCarModelsTableAdapters.CarModelsTableAdapter(); //dsCarModels.CarModelsDataTable models = modelAdapter.GetModelsByCarId(makeId); DSContactTableAdapters.tag_OccupTableAdapter GetOccupAdapter = new DSContactTableAdapters.tag_OccupTableAdapter(); DSContact.tag_OccupDataTable Occups = GetOccupAdapter.GetByOccup_ID(idtag_work_field); // List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>(); foreach (DataRow dr in Occups) { values.Add(new CascadingDropDownNameValue((string)dr["Occup_Name"], dr["idtag_Occup"].ToString())); } return values.ToArray(); } [WebMethod] public CascadingDropDownNameValue[] GetSubOccup(string knownCategoryValues, string category) { StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); int idtag_Occup; if (!kv.ContainsKey("Occup") || !Int32.TryParse(kv["Occup"], out idtag_Occup)) { return null; } //dsModelColorsTableAdapters.ModelColorsTableAdapter adapter = new dsModelColorsTableAdapters.ModelColorsTableAdapter(); //dsModelColors.ModelColorsDataTable colors = adapter.GetColorsByModelId(colorId); DSContactTableAdapters.tag_Sub_OccupTableAdapter GetSubOccupAdapter = new DSContactTableAdapters.tag_Sub_OccupTableAdapter(); DSContact.tag_Sub_OccupDataTable SubOccups = GetSubOccupAdapter.GetDataBy_Sub_Occup_ID(idtag_Occup); List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>(); foreach (DataRow dr in SubOccups) { values.Add(new CascadingDropDownNameValue((string)dr["Sub_Occup_Name"], dr["idtag_Sub_Occup"].ToString())); } return values.ToArray(); }

    Read the article

  • Splitting a filename into words and numbers in Python

    - by danspants
    The following code splits a string into a list of words but does not include numbers: txt="there_once was,a-monkey.called phillip?09.txt" sep=re.compile(r"[\s\.,-_\?]+") sep.split(txt) ['there', 'once', 'was', 'a', 'monkey', 'called', 'phillip', 'txt'] This code gives me words and numbers but still includes "_" as a valid character: re.findall(r"\w+|\d+",txt) ['there_once', 'was', 'a', 'monkey', 'called', 'phillip', '09', 'txt'] What do I need to alter in either piece of code to end up with the desired result of: ['there', 'once', 'was', 'a', 'monkey', 'called', 'phillip', '09', 'txt']

    Read the article

  • Using Aggregate functions in DataView filters

    - by Shrewd Demon
    hi, i have a DataTable that has a column ("Profit"). What i want is to get the Sum of all the values in this table. I tried to do this in the following manner... DataTable dsTemp = new DataTable(); dsTemp.Columns.Add("Profit"); DataRow dr = null; dr = dsTemp.NewRow(); dr["Profit"] = 100; dsTemp.Rows.Add(dr); dr = dsTemp.NewRow(); dr["Profit"] = 200; dsTemp.Rows.Add(dr); DataView dvTotal = dsTemp.DefaultView; dvTotal.RowFilter = " SUM ( Profit ) "; DataTable dt = dvTotal.ToTable(); But i get an error while applying the filter... how can i get the Sum of the Profit column in a variable thank you...

    Read the article

  • String.IsNullOrEmpty and Datarow.IsXnull

    - by Jon
    How can I improve this code? What has made this long winded is the fact that I can't use string.IsNullOrEmpty on a data row and instead I have to use a dr.IsHOUSENUMBERNull method AND the string.IsNullOrEmpty to check if it is empty. Why is this? The column in the database is sometimes empty and sometimes NULL. I'm sure this can be written better: If Not dr.IsHOUSENUMBERNull Then If Not String.IsNullOrEmpty(dr.HOUSENUMBER) Then sbAddress.AppendLine(dr.HOUSENUMBER + " " + dr.ADDRESS1) Else sbAddress.AppendLine(dr.ADDRESS1) End If Else sbAddress.AppendLine(dr.ADDRESS1) End If

    Read the article

  • VBNet2008 Transfer DATAREADER rows to CrystalReport DataSet1.xsd

    - by lennie
    Hi Good Guys, I need your help. Please help me as I am a newbie using VB.NET. I have been asked to transfer DATAREADER rows into Crystal Report DATASET1.XSD Here are the coding Private Sub BtnTransfer() dim strsql as string = "Select OrderID, OrderDate from ORDERS" dim DS as new dataset1 '<---crysal report dataset1.xsd dim DR as SqlDataReader dim RW as DataRow = DS.Tables(0).NewRow sqlconn = new sqlconnection(ConnString) sqlcmd = new sqlCommand(strSql, sqlconn) sqlcmd.Connection.open() DR = sqlcmd.ExecuteReader(CommandBehaviour.CloseConnection) Do while DR.READ RW("OrderID") = DR("OrderID") RW("OrderDate") = DR(OrderDate") DS.Tables(0).Rows.ADD(RW) Loop End sub

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >