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

Can you please explain the difference between thread and process?

764


How to achieve Polymorphism in VB.Net?

825


What is the differences between dataset.clone and dataset.copy?

867


How a base class method is hidden?

837


Explain manifest?

716


Explain strong name in .net assembly?

768


Name some of the features of C# which are not present in VB.NET?

794


What is the diff between vb mdi form and .net mdi form?

778


How many languages are supported by .net?

748


What is the main purpose of garbage collector?

727


Explain option explicit?

783


Explain some of the exclusive features which are present in vb?

730


Explain the difference between value and reference types?

688


Which is the tool which can convert visual basic old version to .net compatibility version?

738


What are the advantages of vb.net and c#?

887