954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

my code doest work

this is my code for login but it has an error.it stuck when comes to Myconn.open().
the error is : The ConnectionString property has not been initialized.

this is the code :

Function DBAuthenticate(ByVal strUsername As String, ByVal strPassword As String) As Integer
Dim conMyData As SqlConnection
Dim cmdSelect As SqlCommand
Dim parmReturnValue As SqlParameter
Dim intResult As Integer


conMyData = New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString"))
cmdSelect = New SqlCommand("sp_ValidateUser", conMyData)
cmdSelect.CommandType = CommandType.StoredProcedure
parmReturnValue = cmdSelect.Parameters.Add("RETURN_VALUE", SqlDbType.Int)
parmReturnValue.Direction = ParameterDirection.Input
cmdSelect.Parameters.Add("@noPekerja", SqlDbType.VarChar)
cmdSelect.Parameters.Add("@pWord", SqlDbType.VarChar)
conMyData.Open()
cmdSelect.ExecuteNonQuery()
intResult = cmdSelect.Parameters("RETURN_VALUE").Value
conMyData.Close()
If intResult < 0 Then
If intResult = -1 Then
lblMessage.Text = "Username Not Registered!"
Else
lblMessage.Text = "Invalid Password!"
End If
End If
End Function

pliz anybody can help me. :cry:

pandapatin
Newbie Poster
1 post since Jan 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You