Home > Software engineering >  Connect to the database vb.net string how to become a live one?
Connect to the database vb.net string how to become a live one?

Time:11-01

 Using ShowDataBinding As New DataClasses1DataContext (" Data Source=PC2013030515PKF; Initial Catalog=song; Integrated Security=True ") 
If Not ShowDataBinding. DatabaseExists () Then
MsgBox (" display data failed, please check database connected!" )
The Else
Dim SelData=https://bbs.csdn.net/topics/From cust In ShowDataBinding. Xm1
If SelData. Any Then
DataGridView1. The DataSource=SelData
End the If
End the If
End Using

This is a query statements, I want to realize the connection string
 Using ShowDataBinding As New DataClasses1DataContext (" Data Source=PC2013030515PKF; Initial Catalog=song; Integrated Security=True ") 

This clause into common login interface is set in the main form, through the input login, don't know how code should not write, I am a newcomer, your smile,

CodePudding user response:

The great god are doing, to help the younger brother,

CodePudding user response:

Dim STR as string="fill in the database to connect"
Dim conn as sqldataconnection (STR)
Conn. The open ()
Dim SQL as string="you have to fill out the string for example: select * from the user where the username='" & amp; "Wang & amp;" " '
"Dim CMD as sqlcommand (SQL, conn.)
  • Related