C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




how to update a record in MS ACCESS database by vb.net?Record is not updated even it shows the msg r


Posted Date: 05 Oct 2006      Total Responses: 4

Posted By: tauseef nabi       Member Level: Silver     Points: 2


Pl Help me out on this issue.

M using the code given below:

Dim conn As New System.Data.OleDb.OleDbConnection
conn.ConnectionString = ("provider=Microsoft.Jet.OLEDB.4.0; data source=C:\Documents and Settings\NB\Desktop\CLPDB\CLP.mdb; user id=; password=")
conn.Open()
Dim cmd2 As New OleDb.OleDbCommand("update test set nam=@a1,combo=@a2,Points=@a3 where (rno=@a0) ", conn)

cmd2.Parameters.Add("@a0", txtrno.Text)
cmd2.Parameters.Add("@a1", txtnam.Text)
cmd2.Parameters.Add("@a2", cmbcombo.Text)
cmd2.Parameters.Add("@a3", txtpoint.Text)

txtrno.Text = " "
txtnam.Text = " "
cmbcombo.Text = " "
txtpoint.Text = ""
cmd2.ExecuteNonQuery()
conn.Close()
MsgBox("Record Updated Successfully")



But record is not updated in database even it shows the msg record updated successfully.
Thanks




Responses

Author: Rajaraman    05 Oct 2006Member Level: DiamondRating:     Points: 2
what is problem will you find? Tell me about your problem.


Author: ChandraShekarThota    05 Oct 2006Member Level: DiamondRating:     Points: 2
remove these and try
txtrno.Text = " "
txtnam.Text = " "
cmbcombo.Text = " "
txtpoint.Text = ""
see u will get spaces as updated ones in db try with out these


Author: Ravindra R    05 Oct 2006Member Level: GoldRating:     Points: 2
// try with this, may help u
Dim conn As New System.Data.OleDb.OleDbConnection
conn.ConnectionString = ("provider=Microsoft.Jet.OLEDB.4.0; data source=C:\Documents and Settings\NB\Desktop\CLPDB\CLP.mdb; user id=; password=")
conn.Open()
Dim cmd2 As New OleDb.OleDbCommand("update test set nam=@a1,combo=@a2,Points=@a3 where (rno=@a0) ", conn)

cmd2.Parameters.Add("@a0", txtrno.Text)
cmd2.Parameters.Add("@a1", txtnam.Text)
cmd2.Parameters.Add("@a2", cmbcombo.Text)
cmd2.Parameters.Add("@a3", txtpoint.Text)
cmd2.ExecuteNonQuery()
conn.Close()
MsgBox("Record Updated Successfully")




Author: VijayaShankar    31 Jul 2008Member Level: GoldRating:     Points: 2
check the txtrno.Text is having the id of the selected item. i its not matched with txtrno. it wont update the statment,


Post Reply
You must Sign In to post a response.
Next : datagrid-currentcellchanged
Previous : adrotator requires page refresh to display new image????????
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

internet fax

Contact Us    Privacy Policy    Terms Of Use