serverUrl = readFromIni(My.Application.Info.DirectoryPath & "/config.dll", "Service Information", "IPAddress")

serverID = readFromIni(My " /> 成人影音在线,老司机2019福利精品视频导航,欧美a级网站

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

asp.net連接數(shù)據(jù)庫 增加,修改,刪除,查詢代碼

復(fù)制代碼 代碼如下:
'數(shù)據(jù)庫連接
Public Sub connectionDB()
Try

serverUrl = readFromIni(My.Application.Info.DirectoryPath & "/config.dll", "Service Information", "IPAddress")

serverID = readFromIni(My.Application.Info.DirectoryPath & "/config.dll", "Service Information", "Password")
serverName = readFromIni(My.Application.Info.DirectoryPath & "/config.dll", "Service Information", "userID")
serverDataBase = readFromIni(My.Application.Info.DirectoryPath & "/config.dll", "Service Information", "DataBaseName")
If serverID <> "" Then
connectionSqlString = "server =" + serverUrl + ";Database=" + serverDataBase + ";uid =" + serverName + ";pwd=" + serverID + ";max pool size=500"
Else
connectionSqlString = "server =" & serverUrl & ";integrated security = SSPI ;database = " & serverDataBase & ""
End If
conSql = New SqlConnection(connectionSqlString)
objCommand.Connection = conSql
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub


'數(shù)據(jù)操作執(zhí)行
Public Sub getConn(ByVal SqlStr As String, ByVal TableName As String)
Try
objCommand.CommandText = SqlStr
objDataSet.Clear()
objDataAdapter.SelectCommand = objCommand
objDataAdapter.Fill(objDataSet, TableName)
Catch ex As Exception
errNo = 1
MsgBox(ex.Message)
End Try
End Sub
'數(shù)據(jù)更新
Public Sub updateTable(ByVal StrSql As String)
objCommand.CommandText = StrSql
Try
conSql.Open()
Trans = conSql.BeginTransaction
objCommand.Transaction = Trans
objCommand.ExecuteNonQuery()
Trans.Commit()
Catch ese As Exception
MsgBox(ese.Message)
Trans.Rollback() '如果更新異常則取消所有更新
Finally
conSql.Close() '關(guān)閉連接
End Try
End Sub

AspNet技術(shù)asp.net連接數(shù)據(jù)庫 增加,修改,刪除,查詢代碼,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 庄河市| 保靖县| 洪泽县| 井冈山市| 泰宁县| 闽清县| 留坝县| 织金县| 富阳市| 怀来县| 民乐县| 宝丰县| 文昌市| 读书| 龙口市| 古浪县| 庆安县| 大渡口区| 五莲县| 凤城市| 英超| 浦东新区| 环江| 汕尾市| 万安县| 山东| 三门峡市| 永吉县| 正阳县| 仁寿县| 陈巴尔虎旗| 柯坪县| 额尔古纳市| 昆明市| 凤庆县| 五华县| 山阴县| 江阴市| 黄平县| 东明县| 通州区|