Add data to access table in vb.net -
i have created form in visual studio 2010 & following code using
private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click dim dbprovider = "provider=microsoft.ace.oledb.12.0;" dim dbsource = "data source=|datadirectory|\membership.accdb" dim con new oledb.oledbconnection con.connectionstring = dbprovider & dbsource con.open() dim sql = "insert memberdetail (membername, memberadd, membercontact, memberphone1, memberphone2, membersince) values (?, ?, ?, ?, ?, ?)" using cmd = new oledb.oledbcommand(sql, con) cmd.parameters.addwithvalue("@p1", me.memname.text) cmd.parameters.addwithvalue("@p2", me.memadd.text) cmd.parameters.addwithvalue("@p3", me.memcontact.text) cmd.parameters.addwithvalue("@p4", me.memphone1.text) cmd.parameters.addwithvalue("@p5", me.memphone2.text) cmd.parameters.addwithvalue("@p6", me.datetimepicker1.text) cmd.executenonquery() end using me.close() end sub
but edits available data in table everytime , not add new row table when enter new data.
where wrong.
please help.
Comments
Post a Comment