![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2006
Posts: 2
Rep Power: 0
![]() |
I have a function which calls a stored procedure as follows:
to login to an sql server 2005 db ---------------------------------------------------------------------------*------------- Function Validate(UserName As String, Password As String, objrs As ADODB.Recordset) Dim msg As String On Error GoTo ERROR_handler '-- Open a connection to SQL database Set m_ObjConn = New ADODB.Connection m_ObjConn.CursorLocation = adUseClient objrs.CursorType = adOpenStatic objrs.LockType = adLockBatchOptimistic m_ObjConn.ConnectionTimeout = 60 m_ObjConn.connectionstring = g_strConnectionString m_ObjConn.Open Set m_ObjConn = objcmd.ActiveConnection objcmd.CommandType = adCmdStoredProc objcmd.CommandText = "TT_UserLogin" objcmd.Parameters.Refresh objcmd.Parameters("@UserName") = UserName objcmd.Parameters("@Password") = Password Set objrs = objcmd.Execute ERROR_handler: msg = Err.Description End Function ------------------------ Here is a the sp ------------------------- set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER Procedure [dbo].[TT_UserLogin3] ( @UserName nvarchar(100), @Password nvarchar(50) ) AS SELECT UserName FROM TT_Users WHERE UserName = @UserName AND Password = @Password And here is the form code ------------------------------------ Private Sub Command1_Click() Dim msg As String On Error GoTo ERROR_handler Validate txtusercode.Text, txtPassword.Text, objrs While Not objrs.EOF If txtusercode = objrs!UserName And txtPassword = objrs!Password Then MsgBox "Successfull!!!" Else MsgBox "Not Successfull" End If Wend ERROR_handler: msg = Err.Description End Sub Can some one really help me out, am stuck and pliz any good samaritan out there |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Read the forum's rules/FAQ and a "How to Post..." thread before dumping ugly, unindented code on your potential respondents.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Newbie
Join Date: May 2006
Posts: 2
Rep Power: 0
![]() |
Am sorry but I had to do it coz, there is no way I could explain,
O.k Do u have any clue on how I can call sql server 2005 stored procedures in vb 6.0 esoecially the insert procedures so that i insert some data in the sql database. Help pliz Robinhood Kampala Uganda |
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
So you still haven't read the rules/FAQ and "How to Post..." thread, which would inform you that you can "explain" inside a box that retains formatting and whitespace.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#5 | ||
|
Professional Programmer
Join Date: Mar 2005
Location: Student of University of Mumbai, Maharashtra State, India
Posts: 344
Rep Power: 4
![]() |
Quote:
Edit your post (Edit option, you would see on your post).. Once you are in the advanced editor, the code of your program should be enclosed in Quote:
__________________
Visit: http://www.somaiya.edu |
||
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|