sql数据连接问题sql数据库在中怎样连接(语句怎样写?)
sql在 中怎样连接(语句怎样写?)
例子: 1.在客户方(Html)中加入: <%@ Import Namespace=System.Data %> <%@ Import NameSpace="System.Data.OLEDB" %> <%@ Import NameSpace="System.Data.SQLClient" %> 2.在服务器方(Server)引用: Dim cn As New OleDb.OleDbConnection() cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=sa;Password=;Initial Catalog=MyDataBase;Data Source= " cn.Open() Dim strSql As String, i As Integer, j As Integer strSql = "Select * From tTable " Dim rs As OleDb.OleDbDataReader Dim cmd As New OleDb.OleDbCommand(strSql, cn) rs = cmd.ExecuteReader While rs.Read() = True If IsDBNull(rs("FieldName")) Then txtName.Text = "" Else txtName.Text = rs("FieldName") End If ... End While rs.Close() cn.Close() rs = Nothing cn = Nothing