Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have searched around on the web and this site and haven't come across what I need. Maybe i'm not looking in the right places, but anyway..

 

I have an access database with user name/passwords and a webform with a textbox for username and another for password.

 

I have worked with the oledb connection and understand that in an application but I am stumped on how to do it for a webpage.

 

If anyone could point me in the right direction or show me an example I would greatly appreciate it.

Posted

I tried doing that but when I got to filling the dataset it came up with an error. I can't give you the error message now as I'm at work.

 

When I get home i will post what code I use and the error.

Posted

Ok, this is what I have

 

Code:

 

Function CheckLogin(ByVal username As String, ByVal password As String)

 

Dim sql As String = "SELECT * FROM User WHERE name = '" & username & "' AND password = '" & password & "'"

 

Dim objDsName = New DataSet()

Dim objDaName = New OleDbDataAdapter(sql, cnstring)

objDaName.Fill(objDsName, "Temp")

 

If objDsName.tables(0).rows.count = 1 Then

Panel3.Visible = True

Panel4.Visible = False

Else

Panel3.Visible = False

Panel4.Visible = True

End If

 

objDsName.dispose()

objDaName.dispose()

 

End Function

 

 

 

Error:

 

Server Error in '/WebApplication1' Application.

--------------------------------------------------------------------------------

 

URI formats are not supported.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

 

Exception Details: System.ArgumentException: URI formats are not supported.

 

Source Error:

 

 

Line 62: Dim objDsName = New DataSet()

Line 63: Dim objDaName = New OleDbDataAdapter(sql, cnstring)

Line 64: objDaName.Fill(objDsName, "Temp")

Line 65:

Line 66: If objDsName.tables(0).rows.count = 1 Then

 

 

Source File: c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb Line: 64

 

Stack Trace:

 

 

[ArgumentException: URI formats are not supported.]

Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)

Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)

WebApplication1.WebForm1.CheckLogin(String username, String password) in c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb:64

WebApplication1.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb:52

System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

System.Web.UI.Page.ProcessRequestMain()

Posted

Ok, now I can get a little further!!...

 

I now have an error that says Syntax Error in From clause. The error occurs when I fill the dataset.

 

sql = "SELECT name, password FROM User WHERE name = '" & TextBox1.Text & "' AND password = '" & TextBox2.Text & "'"

 

I break the program to see if the variables are correct and they are what the textbox's have in them.

 

 

And yes, I have made sure the database table name and fields are correct.

 

This is getting to me now!!!

 

 

You said to point to the database where it resides on the computer, but how do I set it up when it is on a webserver somewhere?

Posted
look access is somehow an idiot in this issue(all issues i think), i have two propasals; first try to put the complete name in the select such as [tablename].[fieldname];if this didnt work, try changing the names of your fields, believe me this sometimes work.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...