G
G
Governor2017-02-27 21:09:31
Visual Basic
Governor, 2017-02-27 21:09:31

VB.Net and MS SQL Server how to connect?

I'm already worn out with this vb.net, I can't connect sql server with the program in any way.
I made labs according to the training manual, but nothing is really described there. I connected to the database through controls in the constructor, but I didn’t get the field value there either. All were automatically displayed in the DataGridView element. They said to do the CPC, and that everything would be human, through the login and password, etc. But bitch! How to get the value of the field was never explained. I've been suffering for a couple of days now.
1) How to join the database without controls (code)?
Tried like this:
Dim connect As New SqlClient.SqlConnection("Data Source=C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER; Initial Catalog=user; Persist Security Info=false; User ID='USER-PC\ USER';Password=;")
The server is on the same computer, when connect.open () gives an error, the server was not found.
How to fill this x *** yu?
And please give an example of the code for getting the field value.
For example, there is a user table, where the fields are:
ID int, login varchar(30), pass varchar(30), admin varchar(1);
It is necessary to receive SELECT pass FROM user WHERE ID = 1;
How can I store the result in a variable?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rou1997, 2017-02-28
@Rou1997

How without controls (code) to join the database?

There is a pretty comprehensive answer to this topic here :

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question