How to Insert a TextBox value in to Sql database using
VB.Net coding?

Answer Posted / anusuya

dim con as new sqlconnection
dim da as sqldataadapter
dim ds as new dataset
dim str as string

con.connectionstring="server=localhost;uid=sa;pwd=;database=
Hospital"
con.open
str="insert into patient values('" & lblid.Text & "','" &
txtname.Text & "','" & rtxtaddress.Text & "','" &
DateTimePicker1.Text & "','" & cmbgender.Text & "','" &
txtphone.Text & "','" & txtemcon.Text & "','" &
txtdoreg.Text &"')"
da=new sqldataadpter(str,con)
da.fill(ds,"patient")
msgbox "New Row inserted"
con.close

Is This Answer Correct ?    30 Yes 24 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain about rapid application development tool?

714


What is enumerator?

801


What are jagged arrarys ?

768


What is a literal control?

751


Write program in VB.Net with SQL Server and Crystal Reports to develop a small windows application to add,edit,save, search and print Employee Information and send sourcecode as zip file. empcode : .............. empname : .............. dateofjoin : dd/mm/yyyy dateofbirth : dd/mm/yyyy TableName: EmpMaster EmpCode EmpName DOB DOJ TableName: EmpDocs EmpCode DocNo DocName ExpDate

2406


What is early binding?

708


Explain internal keyword in .net framework?

748


What is the role of new keyword?

812


What is a static class?

772


What is the difference between manifest and metadata?

743


What are the different variables in vb.net?

711


Why is the xml infoset specification different from the xml dom?

727


Explain the use of serialization and deserialization?

766


What is the difference between compiler and interpreter?

761


Explain the use of new keyword?

734