how to INSERT FROM in vb.net if you are getting values from textboxes?

Recommended Answers

All 2 Replies

Where u want to insert??

In database or what???

hello !
if you want to insert data from vb.net form to your mssql database then this code will help you

dim mycon as new sqlconnection("connectionstring")
mycon.open()
dim cmd as new sqlcommand
cmd.connection=mycon
cmd.commandtext="insert into table (field1,field2) values (@field1,@field2)"
cmd.parameters.addwithvalue("@field1",txtField1.text)
cmd.parameters.addwithvalue("@field2",txtField2.text)
cmd.executenonquery()
mycon.close()

Hope this will helps you :)
Regards

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.