...... string myConnection = 连接数据库! sql="select username from users where id="&request("id") SqlDataAdapter myCommand = new SqlDataAdapter(sql,myConnection); sql2="select username from list where id='"&una&'"" SqlDataAdapter myCommand = new SqlDataAdapter(sql2,myConnection);建议去看看Quickstart
Public Sub dosql(ByRef sqlstr As String) Dim myConnection As New SqlConnection(constr) Dim mycommand As New SqlCommand Try mycommand.Connection = myConnection mycommand.CommandText = sqlstr myConnection.Open() mycommand.ExecuteNonQuery() Catch ex As Exception sqlstr = "wrong:" + ex.Message.ToString End Try mycommand.Dispose() myConnection.Close() myConnection.Dispose() End Sub
string myConnection = 连接数据库!
sql="select username from users where id="&request("id")
SqlDataAdapter myCommand = new SqlDataAdapter(sql,myConnection);
sql2="select username from list where id='"&una&'""
SqlDataAdapter myCommand = new SqlDataAdapter(sql2,myConnection);建议去看看Quickstart
Dim myConnection As New SqlConnection(constr)
Dim mycommand As New SqlCommand
Try
mycommand.Connection = myConnection
mycommand.CommandText = sqlstr
myConnection.Open()
mycommand.ExecuteNonQuery()
Catch ex As Exception
sqlstr = "wrong:" + ex.Message.ToString
End Try
mycommand.Dispose()
myConnection.Close()
myConnection.Dispose()
End Sub