Using ShowDataBinding As New DataClasses1DataContext("Data Source=PC2013030515PKF;Initial Catalog=song;Integrated Security=True")
If Not ShowDataBinding.DatabaseExists() Then
MsgBox("顯示資料失敗,請檢查資料庫連通!")
Else
Dim SelData = From cust In ShowDataBinding.xm1
If SelData.Any Then
DataGridView1.DataSource = SelData
End If
End If
End Using這是一個查詢的陳述句。我想實作連接字串的
Using ShowDataBinding As New DataClasses1DataContext("Data Source=PC2013030515PKF;Initial Catalog=song;Integrated Security=True")這句變成通用的 在主表單設定登陸界面,通過輸入進行登陸,不知道代碼應該怎沒寫。我是新人。多多指教一下吧。
uj5u.com熱心網友回復:
大神們都在干嘛呢。來幫幫小弟吧。uj5u.com熱心網友回復:
dim str as string="填寫要連接的資料庫"dim conn as sqldataconnection(str)
conn.open()
dim sql as string ="你要填寫的字串 比如:select * from user where username= '"& "小王" &"'"
dim cmd as sqlcommand(sql,conn)
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/147702.html
上一篇:用VB找出一段最大值和最小值
