私は、Visual Studio 2010 を使用して VB.Net で Web サイトを構築する開発者です。ユーザーが前の画面での決定に基づいて Web サイトにアクセスしたときに、いくつかのフィールドにデータを入力しようとしています。
私の接続情報は次のとおりです。
Dim myDataReader As SqlDataReader
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim strSQL As String
myConnection = New SqlConnection("Data Source=localhost\sqlexpress; Database=PREP; Integrated Security=SSPI;")
Try
myConnection.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try
strSQL = "SELECT * FROM Charts where ID=1"
myCommand = New SqlCommand(strSQL, myConnection)
myDataReader = myCommand.ExecuteReader()
If myDataReader.Read() Then
TextBox1.Text = myDataReader.Item("Priority1")
Else
MsgBox("Didn't work...")
End If
私が引き続き取得するエラーは次のとおりです。
ログインでデータベース「PREP」を開くことができません。ログインに失敗しました。ユーザー「OR-AA-Me\Me」のログインに失敗しました
これはローカルデータベースなので、ユーザー名とパスワードは必要ないと思いました。私が間違っている?
また、これを商用環境に転送するときに賢明ではない、上記のコードに明らかな慣行はありますか?
ありがとう!