SEARCH

The How-To Geek Forums Have Migrated to Discourse

How-To Geek Forums / Geek Stuff

Vb.Net and SQL server

(2 posts)
  • Started 6 years ago by mlahleki
  • Latest reply from TooManyToyz
  • Topic Viewed 868 times

mlahleki
Posts: 1

Guys please help me out i'm stuck in this project. I'm developing it with Vb.net and SQL for database, Could plz help me connect VB and SQL.and at least enter 1 record in the database.

Posted 6 years ago
Top
 
TooManyToyz
Posts: 2

This is C# for getting data from a table. VB.Net will use the same objects so you should be able to look it up on MSDN and then figure out the rest.

http://msdn2.microsoft.com/en-.....ction.aspx

SqlConnection conn = new SqlConnection("the conn string");
string query = "Select * From YourTableName"
DataTable dt = new dt("MyTable");
SqlCommand cmd = new SqlCommand(query, db);
cmd.CommandTimeout = 30;
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);

Posted 6 years ago
Top
 



Topic Closed

This topic has been closed to new replies.