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
Tell us how many languages are supported by .net?
What is the difference between custom control and user control?
Which properties are used to bind a DataGridView control?
What are the features of c# which are not present in vb.net?
What is difference between import system.data.sqlclient,system.data.oledb?
what is the advantage of option strict on?
Which namespace are used for accessing the data?
What is break mode? What are the options to step through code?
What are the differences between server-side and client-side code?
What are the different types of a stream?
Explain about branching logic control in vb.net?
Which class allows an element to be accessed using unique key?
What are the types of generations in garbage collector?
What are the parts of the visual basic control?
What is early binding?