Thursday, October 28, 2010

How to update a table enteries in MS ACCESS using Vb.net?

tell me a way to update the existing entries in a table in MS ACCESS using vb.net. i ve to update the ';amount'; field of all customer of a bank every time they withdraw and deposit.kindly help me as soon as possible. How to update a table enteries in MS ACCESS using Vb.net?
K so follow this steps

First add oledbcommandbuilder

means u have to give a varible for it

as

dim adpt as new oldebdataadapter

dim ds as new dataset

dim cb as new oledbcommandbuilder(adpt)

adpt.update(ds,';tablename';)

msgbox(';Record Is Updated';)

hope u know the way of using oledbdataadapter

take care

peace be with u How to update a table enteries in MS ACCESS using Vb.net?
u can use database connection to insert data into tables



'Creating connection Object

set Conn=server.createobject(';ADODB.Connecti鈥?br>
'Creating Recordset Object

set rs = Server.CreateObject(';ADODB.Recordset';)

'Initialising Provider String



connStr=';DRIVER={Microsoft Access Driver (*.mdb)}; DBQ='; %26amp; Server.MapPath(';Studentrecords.mdb';)



'Opening Connection to Database

Conn.open connStr



strSQL_Insert = ';INSERT INTO tblStudent ( FName, SurName, Email, StudentNo, Password, Keystage, EntryTime)'; %26amp; _

'; VALUES (''; %26amp; strName %26amp; ';',''; %26amp; strLastName %26amp; ';',''; %26amp; strEmail %26amp; ';',''; %26amp; strUserName %26amp; ';',''; %26amp; strPassword %26amp; ';',''; %26amp; strKS %26amp; ';',''; %26amp; strDate %26amp; ';');';



On error resume next

rs.execute(strSQL_Insert)



Conn.Close

Set Conn = Nothing

No comments:

Post a Comment