English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Dim conn As OleDb.OleDbConnection = New OleDb.OleDbConnection
Dim comm As OleDb.OleDbCommand = New OleDb.OleDbCommand("Select User Name, Password From AuthorizedInventoryStaff.mdb Where User Name='" & txtUserName.Text & "'and Password='" & txtPassword.Text & "'", conn)
Dim ds As New DataSet

comm.fill(ds, "AuthorizedInventoryStaff.mdb")

If ds.Tables("AuthorizedInventoryStaff.mdb").Rows.Count > 0 Then
response.redirect("Welcome.vb")
Else
response.redirect("Login.vb")
End If

2006-07-21 17:50:41 · 4 answers · asked by braich_gal 3 in Computers & Internet Programming & Design

using Ms access and ASP not asp.net

2006-07-21 17:51:20 · update #1

on the code page..the line comm.fill is underlined (fill not a member of system.data.oledb.oledbcommand) and response is also underlined(name not declared)..how to correct this?

2006-07-21 18:00:29 · update #2

am using the windows application template in ASP with vb project..

2006-07-21 18:23:26 · update #3

sorry...minor mistake in the question..i am using visual stusio .net 2003

2006-07-21 18:48:43 · update #4

4 answers

"Password From AuthorizedInventoryStaff.mdb"
AuthorizedInventoryStaff.mdb is the database - you need to specify table you're trying to retrieve the data from

Fill is not a method of the OleDbCommand object - it is a method of a DataAdapter object.

You never define the connection string, and never open the connection.

You're redirecting to a vb extension - that's not asp
unless you're redirecting to an asp.net page.
You should use server.transfer to redirect to the new page, as it maintains form information - redirect loses any form info.

Basic code:
(Make sure ado.vbs is included)
set cn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
set cmd=server.createobject("adodb.command")

strSql="select * from where username='" &
txtuser.text & "' and password='" & txtpassword.text & "'"
cn.connectionstring="" (go to http://www.connectionstrings.com if you don't know about the connectionstring)
cmd.commandtype=adcmdtext(look this up - haven't had to do this in a while - it might be a different constant)

cmd.commandtext=strSql
cmd.connection=cn
set rs=cmd.execute
if not rs.eof or rs.eof then
response.redirect("Welcome.asp")
else
response.redirect("login.asp")
end if

An asp page is not a windows application - it's a web application.
You can't use the template to accomplish what you're attempting.

I would suggest using an asp.net web application.
Look at http://msdn.microsoft.com (search for oledb and access) for more information on connecting to an access database using oledb.
create your connection
create a command object
create a datareader object
set the connection string
associate the connection object
build the sql string
set the datareader object to the results of the command object's executereader method.
check the hasrows property of the datareader
if true - login is valid - destroy objects and redirect to welcome page
if fals - login is invalid destroy objects and redirect to login page

Remember - this is not a windows application, it's a web application.

2006-07-21 18:03:09 · answer #1 · answered by ZressE 3 · 2 0

Are you using global or local declared variables? Are they being called from elsewhere? I have only taken one basic programming course, but it seems you have a problem (using VBScript) at line 1 position 10 syntax error. Maybe this will help you. Good luck.

2006-07-21 18:04:40 · answer #2 · answered by up.tobat 5 · 0 0

i won't be able to talk for different men, yet i'm no longer a "manly guy" or a "male apologist." (in case you want information, only study a number of my GS solutions, lol) i imagine male apologists are ridiculous and stupid, however it is compared to being a "manly guy" is the purely different determination. in my view, i have continually sucked at "masculine" such issues as events, and that i have continually been more effective interested in "female" such issues as books and artwork. i won't be able to fairly help it; it is only how i'm. at the same time, i'm thoroughly anti-feminist, and that i do not attempt to cover this certainty from women. i'm really no longer confident no matter if those who comprehend me might want to classify me as "the total guy."

2016-11-25 01:14:01 · answer #3 · answered by eisenhauer 4 · 0 0

Can you tell us what's not working? Is it the select query...is there a syntax error? Some hints would be nice.

2006-07-21 17:54:13 · answer #4 · answered by Brian S 2 · 0 0

fedest.com, questions and answers