Hey Guys

, I've recently stopped doing some of the projects which I wanted to do and took a look at SQL and came across Microsoft SQL and i was pretty pleased with wha tit can do so i downloaded the program and watched some basic MSSQL tutorials on how to add, remove, make tables etc. So first I made a database and called it 'SimpleServer'. Then I made a table and added some values in each column and executed the program. See the picture for results: http://puu.sh/4MhEj.png
.
.
.
Then I moved to Visual Studio and just made a quick test form with the labels and textboxes which the values from the MSSQL represent and added that to the form: http://puu.sh/4MhEP.png
.
.
.
So the goal here is to enter the username in the textbox in the form and clicking the 'Get User' button will get the required information about that prson and display it in the appropriate textbox. The one problem I have right now is...I can't seem to get a final pice of code or debug file etc from MSSQL to put it in the form. I've worked with databases before like the simpler ones like Office Access but this is way different and I can't seem to connect it together so that once the form is running, user enters the name and clicking 'Get User' will get the information.

Can someone help me with this issue. I hope it's not too much too ask as I want to get started on the basics and the basics I mean this program. How can I connect SQL to VB and make it a whole so that the form takes information from the database and displays it.

Thank you!

Edited 3 Years Ago by Ahmed.C

Do you know how I can export or use the Database I created in mssql to visual studio? It's basically like using Access files except it's not..

Do you mean just to connect your form to a data source, query the DB and display the results in the form?

Start with...to test your connection. You need to build the connection string. This string has the information about the hostname of the SQL server. The connection string may include username and password, etc...

 Try  
   conn = New SqlConnection(connString)  
   conn.Open()  
   MessageBox.Show("Connection Successful")  
 Catch ex As Exception  
   MessageBox.Show(ex.Message)  
 End Try 
This article has been dead for over six months. Start a new discussion instead.