通过编码vb.net将sql客户端加入sql server
问题描述:
我想将SQL Client(另一台PC)与SQL Server联系以获取访问数据,你可以通过编写VB.NET来帮助我吗?
我尝试了什么:
我无法通过服务器资源管理器和编码浏览。
我不知道问题
I would like to joint SQL Client(another PC) to SQL Server for access data, Can u help me by coding VB.NET?
What I have tried:
I can't browse by Server Explorer and Coding.
I don't know problem
答
很难说出你的问题是什么。
假设(如果我是正确的话)你想从VB项目访问SQL服务器上的数据吗?
非常原始的例子:
Hard to tell what your problem is from this.
Assuming (correct me if I am wrong) you would like to access data on an SQL server from a VB project?
Very primitive example:
Import System.Data.SqlClient
Sub AccessDatabase
Dim oSQLConnection As New SqlConnection
Dim oSQLCommand As SqlCommand
Dim oSQLDataReader As SqlDataReader
oSQLConnection = New SqlConnection("Initial Catalog=Database; _
User ID=UserID ;Data Source=ServerName;Password=Password)
oSQLConnection.Open()
oSQLCommand = New SqlCommand("SELECT * FROM table", oSQLConnection)
oSQLDataReader = oSQLCommand.ExecuteReader
etc...
End Sub
希望这会有所帮助,但请提供更多信息,如果这不是你需要知道的。
Hope this helps but please provide more information if this is not what you needed to know.