Connecting Tech Pros Worldwide Forums | Help | Site Map

vb.net 2003 display data from Sql DB

Newbie
 
Join Date: Jun 2007
Posts: 2
#1: Jun 20 '07
So far I have a datagrid that can display data from Sql DB. I also have the edit, update, and cancel buttons working properly once the data is already in the database.

I am having difficulty entering new user data into DB however. I can enter fake data with a simple insert command and then update it, but I need a proper insert code for the first row of data to insert. Below I have started the add code to the datagrid. I have it to the point where the user can fill out the info that needs to be inserted to the DB, now I need the insert command, anyhelp??
Thanks for any advice!!!!!!!!

Dim dr As DataRow = Me.DsEnroller4.Transmittal.NewTransmittalRow
dr("RepName") = Person
dr("CurrentDate") = txtDate.Text

Me.DsEnroller4.Transmittal.Rows.InsertAt(dr, 0)
Session("DsEnroller") = DsEnroller4

DataGrid1.EditItemIndex = 0

DataGrid1.DataBind()

kenobewan's Avatar
Moderator
 
Join Date: Dec 2006
Posts: 4,745
#2: Jun 21 '07

re: vb.net 2003 display data from Sql DB


Welcome to TSDN. Once you have the updated vales insert them using sql. What is problem?
Newbie
 
Join Date: Jun 2007
Posts: 2
#3: Jun 21 '07

re: vb.net 2003 display data from Sql DB


I'm not sure how to write the insert command and execute it in my code. I haven't programmed in a couple years so I think the problem is between the chair and keyboard (me). How do I declare the variables from the datagrid in my sql insert command, Parameters? Lets pretend I was inserting three new columns FirstName, LastName, EmpID. What would be the proper code/sql query to insert new record to sql db.

Thanks!!
Newbie
 
Join Date: Jun 2007
Posts: 1
#4: Jun 24 '07

re: vb.net 2003 display data from Sql DB


How To Insert Into Datagrid And Text Box From The Same Databse In Vb.net 2003?
Reply