主题:VB2005求助:调试时在myconnection.Open()语句处提示:用户‘sa’登录失败。
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Dim myconnection As SqlConnection
Dim connstr As String = "server=localhost; database=hr1; uid=sa; pwd=;"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
myconnection = New SqlConnection(connstr)
Dim mycommand As SqlCommand
Dim mydatareader As SqlDataReader
mycommand = New SqlCommand("select * from zad00000", myconnection)
myconnection.Open()
mydatareader = mycommand.ExecuteReader()
Dim i As Integer
For i = 0 To mydatareader.FieldCount - 1
TextBox1.Text = mydatareader.Item(i)
Next
TextBox1.Text = vbNewLine
myconnection.Close()
End Sub
End Class
调试时在myconnection.Open()语句处提示:用户‘sa’登录失败。
请各位老师指导应该怎么做?谢谢。
Imports System.Data.SqlClient
Public Class Form1
Dim myconnection As SqlConnection
Dim connstr As String = "server=localhost; database=hr1; uid=sa; pwd=;"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
myconnection = New SqlConnection(connstr)
Dim mycommand As SqlCommand
Dim mydatareader As SqlDataReader
mycommand = New SqlCommand("select * from zad00000", myconnection)
myconnection.Open()
mydatareader = mycommand.ExecuteReader()
Dim i As Integer
For i = 0 To mydatareader.FieldCount - 1
TextBox1.Text = mydatareader.Item(i)
Next
TextBox1.Text = vbNewLine
myconnection.Close()
End Sub
End Class
调试时在myconnection.Open()语句处提示:用户‘sa’登录失败。
请各位老师指导应该怎么做?谢谢。