救急!!
用ASP.NET做一个网站,后台用SQL2000;
在自己的机器上用都是OK。SQL和WEB都在本地;
结果放到网上后,就出现问题:SQL不存在或拒绝访问!!
代码如下:
'---------
Imports System.Data
Imports System.Data.SqlClient
Public Function ConnectionString() As String
ConnectionString = "server=服务器名;database=数据库名;uid=******;pwd=******"
' 服务器名、数据库名、用户名和密码通过SQL的企业管器能够连接上,但在通过程序却出现问题:
'SQL不存在或拒绝访问!!
End Function
Public Function CreateDataSource(ByVal txtStr As String) As DataTable
CreateDataSource = New DataTable
Dim Con As New SqlConnection(ConnectionString)
Dim Cmd As SqlDataAdapter
Cmd = New SqlDataAdapter
Cmd.SelectCommand = New SqlCommand
Cmd.SelectCommand.CommandText = txtStr
Cmd.SelectCommand.Connection = Con
Try
Dim Dset As DataSet
Dset = New DataSet
Cmd.Fill(Dset, "1")
Return Dset.Tables("1")
Catch ex As Exception
End Try
End Function
End Module
'------