asp.net 1.1 sql server 2000怎么实现

此软件服务器运行环境:asp.net1.1sqlserver2000,也就是说必须安装在“asp.net1.1sqlserver2000”服务器上才能使用。... 此软件服务器运行环境:asp.net 1.1 sql server 2000,也就是说必须安装在“asp.net 1.1 sql server 2000”服务器上才能使用。 展开
 我来答
dragon_ghy
2009-11-25
知道答主
回答量:7
采纳率:0%
帮助的人:6615
展开全部
Imports System.Data.SqlClient
Public Class sqldb
Dim conn As New SqlConnection
Private strConn As String
Public Function checkconnection(ByVal str As String) As Boolean
Dim isFlag As Boolean = False
If conn.State = ConnectionState.Closed Then
conn.ConnectionString = str
conn.Open()
Return True
End If
Return False
End Function
Public Function checkconnection() As Boolean
Dim isFlag As Boolean = False
conn.ConnectionString = strConn
conn.Open()
If conn.State = ConnectionState.Open Then
isFlag = True : conn.Close()
End If
Return isFlag
End Function

Public Function returntable(ByVal sqlstr As String) As DataTable
Dim da As New SqlDataAdapter(sqlstr, conn)
Dim ds As New DataSet
conn.Close()
conn.ConnectionString = constr
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
da.Fill(ds)
Return ds.Tables(0)
End Function
Public Sub inupde(ByVal sqlstr As String)
Dim com As New SqlCommand(sqlstr, conn)
com.ExecuteNonQuery()
End Sub
Public Function insertupdel(ByVal strUser As String, ByVal strPassword As String) As Boolean
Dim isFlag As Boolean = False
Dim StrNewSql As String = "Select txtuserid From users Where txtuserid='" & strUser & "'"
Dim strIntSql As String = "insert into users(txtuserid,txtpassword)Values('" & strUser & "','" & strPassword & "') "
Dim com As New SqlCommand
com.CommandText = StrNewSql
conn.ConnectionString = strConn
com.Connection = conn
If conn.State <> ConnectionState.Open Then conn.Open()
Dim dr As SqlDataReader = com.ExecuteReader() '这里是操作数据库,
If (Not dr.Read()) Then 'DR.Read()向前读数据库,如果数据库有数据,返回TRUE,说明不能添加了,就在前面加NOT,反之,如果数据库没有,返回FALSE,NOT FALSE=TRUE则执行IF下面的语句
dr.Close()
com.CommandText = strIntSql '这里是INSERT语句
com.ExecuteNonQuery() '这个向数据库添加数据,可以返回影响的条数
isFlag = True
End If
com.Dispose()
conn.Close()
Return isFlag
End Function
Public Sub New()
strConn = "user id =sa;password=;database=games;data source=."
End Sub
End Class
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
zhangkunzxk
2009-11-30
知道答主
回答量:89
采纳率:0%
帮助的人:19.5万
展开全部
Public Function insertupdel(ByVal strUser As String, ByVal strPassword As String) As Boolean
Dim isFlag As Boolean = False
Dim StrNewSql As String = "Select txtuserid From users Where txtuserid='" & strUser & "'"
Dim strIntSql As String = "insert into users(txtuserid,txtpassword)Values('" & strUser & "','" & strPassword & "') "
Dim com As New SqlCommand
com.CommandText = StrNewSql
conn.ConnectionString = strConn
com.Connection = conn
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
小辛快跑14
2009-11-20 · TA获得超过527个赞
知道小有建树答主
回答量:2958
采纳率:0%
帮助的人:498万
展开全部
SQL2000,好古老啊
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式