| | |
how to insert data into the database in vb.net using textfields.
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
i came up with a quite annoying problem in inserting data into the database in vb.net using the textfields. i tried out with many different ways,but could not sort out this problem.
i used datatables,dataadapters,datasets.Plz if anyone can help me out.
The condition is :
i am using four tables. and in one table the primary key which is auto increment is a FK in the table that i actually use for storing the inserted the data in the textfields.
here is where i am getting the problem:
cn.Open()
str = "insert into tbl_emps(empname,empsal,desgid) values('" & t1.Text & "'," & (t2.Text) & "," & (t3.Text) & ")"
da.Fill(ds, "tbl_emp")
dt.TableName = "tbl_emp"
cn.Close()
is it correct.
2nd Type
cn.Open()
str = "insert into tbl_emps(empname,empsal,desgid) values('"
& t1.Text & "'," & (t2.Text) & "," & (t3.Text) & ")"
cmd.commandtext=str
cmd.executenonquery()
The problem that i get is :
ExecuteReader: CommandText property has not been initialized
i used datatables,dataadapters,datasets.Plz if anyone can help me out.
The condition is :
i am using four tables. and in one table the primary key which is auto increment is a FK in the table that i actually use for storing the inserted the data in the textfields.
here is where i am getting the problem:
cn.Open()
str = "insert into tbl_emps(empname,empsal,desgid) values('" & t1.Text & "'," & (t2.Text) & "," & (t3.Text) & ")"
da.Fill(ds, "tbl_emp")
dt.TableName = "tbl_emp"
cn.Close()
is it correct.
2nd Type
cn.Open()
str = "insert into tbl_emps(empname,empsal,desgid) values('"
& t1.Text & "'," & (t2.Text) & "," & (t3.Text) & ")"
cmd.commandtext=str
cmd.executenonquery()
The problem that i get is :
ExecuteReader: CommandText property has not been initialized
![]() |
Similar Threads
- How to insert data into database? (JSP)
- insert data from one form into two diffent database table (JSP)
- how to insert data from dataset into database (VB.NET)
- How to insert data into a db (Java)
- problem retrive data by ID (VB.NET)
- Insert Data in to Db from the Dynamic Rows (HTML and CSS)
- Unable to insert data into database. (MySQL)
Other Threads in the VB.NET Forum
- Previous Thread: Desktop Short Cut
- Next Thread: IF statement in a varible
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account advanced application array basic beginner browser button buttons center click code combo cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic dropdownlist excel exists fade filter forms ftp generatetags html images input insert intel internet listview mobile module monitor net number objects open panel passingparameters pdf picturebox picturebox2 port position print printing problem regex right-to-left save search searchvb.net select serial settings shutdown soap socket sqldatbase sqlserver survey temperature textbox timer timespan transparency trim txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet visual visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





