Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Acces and asp.net
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Acces and asp.net

 Post Reply Post Reply
Author
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Topic: Acces and asp.net
    Posted: 12 September 2003 at 3:58pm

Hey all,

I've got some sort of a problem, when I try the following: I want to compare an unique id to a field in the database, and then read another collum on that row. How is this done? I tried alot, but I kept recieving this kind of error:

Data type mismatch in criteria expression.

Sooow, how can I first be sure the unique id exists in the table (collum is called 'Uid'), and if so, retrieve the content of the collum next to it (collum is called 'Loggedin').

// Edit: Of course in ASP.NET



Edited by Diep-Vriezer
Gone..
Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 13 September 2003 at 4:34am
Alright, not really a clear question. How about this: I want to read a collumn named Loggedin on a row WHERE Uid = aUniqueId.
 
I made up the following code:

-------

Dim aConnection As OleDbConnection, aCommand As OleDbCommand, aDatareader As OleDbDataReader, aString As String

aConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Pub\wwwroot1\Components\Databases\Account.mdb;User Id=admin;Password=;")

aCommand = New OleDbCommand()

With aCommand

.CommandText = "SELECT * from tblLoggedin where Uid = '" & aUniqueId & "'"

.CommandType = CommandType.Text

.Connection = aConnection

End With

aConnection.Open()

aDatareader = aCommand.ExecuteReader()

While aDatareader.Read

aString = ""

aString = aDatareader.Item("Loggedin")

End While

aDatareader.Close()

aConnection.Close()

-------

Now I revieve the following error: (I just copied the entire error page )

-------

Server Error in '/' Application.

Data type mismatch in criteria expression.

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.Data.OleDb.OleDbException: Data type mismatch in criteria expression.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[OleDbException (0x80040e07): Data type mismatch in criteria expression.]
    System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandli ng(Int32 hr) +41
    System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleRe sult(tagDBPARAMS dbParams, Object& executeResult) +174
    System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& ; executeResult) +92
    System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavio r behavior, Object& executeResult) +65
    System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(Command Behavior behavior, String method) +112
   System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +69
   System.Data.OleDb.OleDbCommand.ExecuteReader() +7
   denheijer.Account.CheckLoggedin(String aUniqueId, String cIp) in C:\Documents and Settings\Floris den Heijer\VSWebCache\DODGER\Components\Classes\Account.vb:32
   denheijer.Start.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\Floris den Heijer\VSWebCache\DODGER\Sections\Start\Start.aspx.vb:33
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731

Gone..
Back to Top
TYSON View Drop Down
Groupie
Groupie


Joined: 18 August 2002
Location: Australia
Status: Offline
Points: 142
Post Options Post Options   Thanks (0) Thanks(0)   Quote TYSON Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2003 at 8:14am

Try

.CommandText = "SELECT * from tblLoggedin where Uid = " & aUniqueId & ""

Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2003 at 8:42am
Well, I already made it by simply changing the aUniqueId to the field it is in the database (an integer), and everything works fine now. Thanks anyway!
Gone..
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.