467,859 Members | 1,402 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,859 developers. It's quick & easy.

Insert Data directly into database using WinForm DataGrid

Hello,
I want to insert data directly into my windows form data grid and load a combobox(userid) in the 1st column of data grid,a textbox(password) in 2nd column of datagrid.
The code for insert data is:
dim cmd as new oledbcommand("insert into table(userid,password) values('" & cmbcol1.text & "','" & txtcol2.text & "')",connection)
dim da as new oledbdataadapter
dim ds as new dataset
da.selectcommand=cmd
da.fill(ds)
messagebox.show "Record Inserted successfully"

I want to insert the data into database so when the user presses the enter key in 2nd column of datagrid(txtcol2.text),the above code for inserting data is executed and cursor moves to second row of 1st column.
can anybody explain me how to achieve this in vb.net 2003 windows form?
Regards:
Danish Majid
Apr 5 '07 #1
  • viewed: 1930
Share:

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

By using this site, you agree to our Privacy Policy and Terms of Use.