please help to connect our vb.net forms with database.
I know make forms and connecting that forms.i know creating tables in database and inserting values in it.no idea about connecting forms and data base.pls help me.we use sql server 2008.i am a beginner in vb.net

Recommended Answers

All 3 Replies

Please ask a specific question. what code have you developed so far?

Sir
We designed a login form. WE want to enter username and password and store those in a table. How can we do that?

hello ! you can do it like this

'first import system.data.sqlclient then
dim myCon as new sqlconnection("your connection string")
dim cmd as new sqlcommand
myCon.open()
cmd.connection=myCon
cmd.commandtext="insert into tablename (field1,field2,field3) values (@field1,@field2,@field3)"
cmd.parameter.add("@field1",______).value = txtvalue1.text 'in place of ___ write datatype of your field in your db.
cmd.parameter.add("@field2",______).value = txtvalue2.text
cmd.parameter.add("@field3",______).value = txtvalue3.text'if you have datatype of your field in your db is int , decimal , bigint, etc then use val(txtvalue.text)
cmd.executenonquery()
myCon.close

this will insert your data in your table . well i write this code here , so may be there are some spelling mistakes , check them by your own self .
If your prob is solved please mark this thread solved .

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.