Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 17th, 2006, 9:03 AM   #1
byamukama
Newbie
 
Join Date: May 2006
Posts: 2
Rep Power: 0 byamukama is on a distinguished road
Angry Operation can not be performed when oject is closed and item can not be found in ordi

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
byamukama is offline   Reply With Quote
Old May 17th, 2006, 9:09 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old May 17th, 2006, 9:16 AM   #3
byamukama
Newbie
 
Join Date: May 2006
Posts: 2
Rep Power: 0 byamukama is on a distinguished road
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
byamukama is offline   Reply With Quote
Old May 17th, 2006, 10:21 AM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old May 17th, 2006, 11:22 AM   #5
java_roshan
Professional Programmer
 
Join Date: Mar 2005
Location: Student of University of Mumbai, Maharashtra State, India
Posts: 344
Rep Power: 4 java_roshan is on a distinguished road
Quote:
Originally Posted by DaWei
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.
byamukama, what you are actually being told to do is ..this..

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:

(open-square-brackets)CODE(close-square-brackets)
your code comes here
(open-square-brackets)/CODE(close-square-brackets)
__________________
Visit: http://www.somaiya.edu
java_roshan is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:19 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC