| | |
my code doest work
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2006
Posts: 1
Reputation:
Solved Threads: 0
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:
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:
![]() |
Similar Threads
- How to Enable/Disable Users thro' C++ or any code (C++)
- what doesnt work? plz help guys (C++)
- Why this code cant work ???? (ASP.NET)
- Null Pointer? will this code work (C)
- Please help me find problem in code :) (C#)
- CSS code for borders does not work (HTML and CSS)
- Converting from VB code to C (C)
- dhtml menu and flash (JavaScript / DHTML / AJAX)
Other Threads in the VB.NET Forum
- Previous Thread: Help Using Selected Values between Tables
- Next Thread: Issue related to combobox....
| Thread Tools | Search this Thread |
.net .net2008 30minutes 2005 2008 access account arithmetic array basic bing button buttons center check code combobox component connectionstring crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dropdownlist excel fade file-dialog filter folder ftp generatetags google gridview hardcopy images input insert intel internet mobile monitor ms net networking objects output panel passingparameters peertopeervideostreaming picturebox picturebox1 port position print printing problem problemwithinstallation project save searchbox searchvb.net select serial shutdown soap survey table tcp temperature text textbox timer timespan toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year





