What is wrong with this code?

Hi all,

Could you please help me with fixing this code because i have no idea what i'm doing wrong!
Thanx already!
ERROR
Server Error in '/' Application.
--------------------------------------------------------------------------------
Syntaxisfout (operator ontbreekt) in query-expressie 1A = 'true'.
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: Syntaxisfout (operator ontbreekt) in query-expressie 1A = 'true'.
Source Error:

Line 12: Dim Cmd as New OLEDBCommand(MySQL, MyConn)
Line 13: MyConn.Open()
Line 14: MyDataGrid.DataSource = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
Line 15: MyDataGrid.DataBind()
Line 16:


CODE
<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
Sub Page_Load(Source as Object, E as EventArgs)

Dim strConn as string = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath(".\Techniek.mdb") & ";"
Dim MySQL as string = "Select Week, Datum, Boek, Hoofdstuk, Paragraaf, Bladzijden, Opdracht, Opmerking from Huiswerk WHERE 1A = 'true' "

Dim MyConn as New OleDBConnection(strConn)
Dim Cmd as New OLEDBCommand(MySQL, MyConn)
MyConn.Open()
MyDataGrid.DataSource = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
MyDataGrid.DataBind()
End Sub
</script>
<html>
<head>
</head>
<body>
<asp:Datagrid id="MyDataGrid" BorderColor="Black" Font-Size="8" Font-Bold="True" Font-Name="Arial" BackColor="#8080FF" Headerstyle-Font-Size="11" Headerstyle-Font-Bold="True" Headerstyle-Font-Name="Arial" Headerstyle-BackColor="#8080C0" cellspacing="0" cellpadding="0" GridLines="Both" runat="server"></asp:Datagrid>
</body>
</html>
0
Januz
7/13/2004 8:59:03 PM
asp.net.access-datasource 4679 articles. 0 followers. Follow

6 Replies
260 Views

Similar Articles

[PageSpeed] 55

What is datatype of 1A?
Sushila Bowalekar Patel
Visual ASP/ASP.NET MVP
http://weblogs.asp.net/sushilasb
0
SushilaSB
7/13/2004 9:30:03 PM
it's a YesNo datatype!
0
Januz
7/14/2004 10:49:42 AM
Then do not use the quotes around True.
Starting with ASP.NET 2.0? Look at:
Programming Microsoft Web Forms
My Blog
0
douglas
7/14/2004 12:36:20 PM
I had already tried that but I then get the following error!

ERROR
Server Error in '/' Application.
--------------------------------------------------------------------------------
Syntaxisfout (operator ontbreekt) in query-expressie 1A = true.
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: Syntaxisfout (operator ontbreekt) in query-expressie 1A = true. Translation >> (operator missing)
Source Error:

Line 12: Dim Cmd as New OLEDBCommand(MySQL, MyConn)
Line 13: MyConn.Open()
Line 14: MyDataGrid.DataSource = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
Line 15: MyDataGrid.DataBind()
Line 16: End Sub

0
Januz
7/14/2004 3:24:10 PM
try enclosing the field name in square brackets, i.e. [1A] = true
Starting with ASP.NET 2.0? Look at:
Programming Microsoft Web Forms
My Blog
0
douglas
7/14/2004 9:59:37 PM
That worked! Thank you all for helping me to get to the solution!! 

0
Januz
7/15/2004 1:52:02 AM
Reply:

Similar Artilces:

.Net Framework Code Access Security
I built a c# .Net 2.0 based user control that I run as an ActiveX control in IE7.  It works fine except for code access security issues ("Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, ......' failed).  To get around the code access security issues, I created a code group within the Machine All_Code group with the Publisher membership conditions based on a valid certificate (which my assembly has) and granted that code group the "Everything" permission set.  Even though my code group is m...

Passing integer array from VB.NET to Access VBA Code (Access 2003 Interop)
Hello, I'm working on a small project to take a current Access database and move it online. I'm using Access automation using Interop (even though its not recommended, but the service wont be used very often). I have the majority of the code working great, except on one VBA function where I pass it an array of integers. Below is a blurp of the code: VBA function: --------------------------------------------------------------------------------------------------------- Public Sub OutputScheduler0708(ProgramId() As Integer, ProgramTypeID() As Integer, ProgramCnt() As Integer, XLSOut...

Translate c#.net code to vb.net code
Hi I can usually do the translation myself, but this time I am a bit stumped  Let us consider to rewrite Urls (more than 16000 links) using a table. Save original url and rewritten url in a table. Now add a class file in App_Code folder. class UrlRewriteModule : IHttpModule{    public void Dispose()    {        // Nothing to dispose    }    public void Init(HttpApplication context)    {        context.BeginRequest += new EventHandler(context...

How to convert C#.Net code to VB.Net code ???...
HI, i was searching something new, then i suddenly find some tips to convert C#.Net code to VB.Net but i did not do well. i am puttint its url here plz tell me how to convert C#.Net code to VB.Net. http://www.dotnetspider.com/code/C-273-Convert-C-VB-NET.aspx Jasim...Please remember to click “Mark as Answer” on the post that helps youJasim AkhtarNew Delhi ( INDIA ) It would be better if you write the problem you having, while converting from C# to VB.NET. You cannot completely rely on online converters. ThanksMark post(s) as "Answer" that helped youElectronic ScrewWebsite||Bl...

Accessing .NET Code from VB
Hi, I have an ASP.NET (C# Code-behind) code. I need the very same functionality in one of my VB 6.0 program. As the code is too complex, I don't want to replicate it in VB once again. Now, is there any way to access my .NET code from VB? Pls advise. Thanks in advance  I dont know but if you dont get anywhere with this then something to consider is to expose the functionality as a webservice? Could a webservice be called from VB Code? I am Sorry ... Seriously don't have much ideas on it. Can u pls provide me with some appropriate links or articles? Thanks, Sangeetha A...

converting Access code to .net
Would there be a way to use this command ?  Me(Value) it worked in Access Maybe there is a way to use it in .Net? What does the command Me(Value) give you? If you could send its output then I can maybe tell you its .Net equivalent.  QI. this is what the code looks like in Access For LineCount = 1 To 5LineStr = "LineCode" & Trim(Str(LineCount)) Next LineCount Me(LineStr) = UCase(Me(LineStr))If Me(LineStr) = "E" Then    Me.PONum.Visible = True  I believe its called Implicit Variables but not sure...

what is the use of code access security in .net
Hi,   what is the use of code access security in .net, and how to work in .net 3.5 If you have your code running in separate assemblies then you can restrict the permission set for that assembly by using CAS.You could restrict a desktop application from making DNS requests for example. This section of msdn is devoted to explaining the concepts and usage of Code Access Security:http://msdn.microsoft.com/en-us/library/930b76w0.aspx Hi good example of CAS is Microsoft SharePoint (WSS 3.0). While Creating your own web parts for sharepoint you will required CAS for your WebPa...

.Net code access security has no effect.
Hi All. I have built a library -MyLib.dll -  for my asp.net application that has been signed using public-private keypair made from sn.exe. I signed it from the signing option in visual studio 2005 and gave the public-private key pair file. I had already added  the StrongNameIdentityPermissionAttribute to one of my classes inside Mylib.dll like the follwowing namespace Test { public class Sample { [StrongNameIdentityPermission(SecurityAction.Demand, PublicKey = "...")] public static void SayHello() { System.Diagnostics.Debug.Writ...

What's wrong in my VB.NET code?
Dear all, I'm trying to write the code for a "login" button, to check if the username & password is correct or not and if it's correct check the type, because I have 3 types of users, and each case there should be an update but it's not updating, please check my code below and tell me what's wrong? why it's not updating in the database? I'm using ASP.NET 2003 and SQL 2000.Private Sub login_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles login_btn.Click CheckAccess() End Sub  Private Sub CheckAccess() Dim type A...

VB.NET code to access the serial port
I have developed a web kiosk, now I am develping the login method that will be via magnetic cards. If I connect the card reader to the keyboard port and there is a textbox in a page it will show the data stored in the card, so I want to connect it to the serial port. In order to read the code I think it will be needed an applet in every web page that monitor the serial port and when the user pass the card it read the magnetic band and makes authentication and so. Does anyone have an idea for me about this???? Is there any sample code to read the serial port? Is there any samp...

accessing MS Access from .net
hi I am accessing ms access data base which has a table called customers. when i try to insert data into the table i am gettign the error like "Operation must use an updatable query" and the line its showing is myOleDbcommand.ExecuteNonQuery() here is my code in page lode event Sub Page_Load(Sender As Object, E As EventArgs) Dim StrConnectString as String Dim strStatement as String strConnectSTring = "Provider=Microsoft.Jet.OLEDB.4.0;Password='';User ID=Admin;Data Source=C:\Inetpub\wwwroot\Srinu\WebApplication2\...

WRONG WRONG WRONG
Name: ROZ mandelcorn Email: thunderstaratearthlinkdotnet Product: Firefox Summary: WRONG WRONG WRONG Comments: as a long-time user, first of netscape and, mozilla firefox, i must say i DO NOT LIKE THE PLACEMENT of TABS in version 4. nor do i like the whole rearrangement of the upper/navigation portion of firefox. I NEED/WANT MY TABS DIRECTLY ABOVE MY WINDOWS AS IT IS NOW....NOT ON TOP OF THE BROWSER. I WANT MY FILE-EDIT-ETC-MENU on TOP. ETC. AT LEAST GIVE US THE CHOICE AS TO WHICH FORMAT WE WANT....CAN YOU SAY CUSTOMIZATION! I WILL NOT USE 4 IF THIS IS THE WAY IT IS. [just ...

Code generation in Microsoft.net ( code that writes code ) Whats its future
Hello, I was just reading a book about Code Generation in .NET. Its damn hard book to read. What do u think is the future of Code GenerationHighOnCodingWanna get high! It's being used now quite a bit. Not necessarily out the box click a button, and you get an application, but applications will generate specific code to function dynamically.Kay LeeMySpace.com - http://www.myspace.com/kragieInfrastructure GroupMySpace.com- Code to live, but Live to code. the refactoring tools already available (and those that are destined for the new IDE) use the same techniques. we will pr...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

Looking for good .NET Code Access Security links
I have been reading several of the Microsoft Code Access Security documents. I was look for good links addition sites (user sites, blog site, etc.) where developers are actively implementing Code Access Security (CAS). Thanks for any feedback. Mark Wagner Simple Thoughts from a Simple Mind Blog: http://blogs.crsw.com/mark...

Web resources about - What is wrong with this code? - asp.net.access-datasource

Wrong - Wikipedia, the free encyclopedia
while civil law countries tend to have some additional categories, such as contraventions . Moral wrong is an underlying concept for legal wrong, ...

NASCAR Directs Facebook Users To Wrong TV Network For Pure Michigan 400
Facebook pages are a useful tool for brands to share information, but they may want to ensure that the information being shared is correct, which ...

Ken Ham - Well, our new “Thank God You're Wrong” billboard... - Facebook
Well, our new “Thank God You're Wrong” billboard campaign began with a big bang (☺ ) yesterday—which we praise the Lord for. As expected, many ...

Facebook says bug caused wrong contact syncing on some users’ phones
A contact synchronization bug, combined with Facebook’s latest changes to users’ email visibility settings , led some mobile phones to update ...

What Went Wrong (@AmericaWWW) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Scripting News: Silicon Valley is wrong about college.
Lately I've been thinking a lot about startup culture, and am reminded of its nobility having started three companies in my career, and learned ...

Scripting News: Why Charles Pierce is wrong about Ezra Klein being wrong.
... Pierce's attitude many times, from all kinds of ink-stained pros, some very accomplished. The arrogance is impressive, but they're still wrong. ...

Scripting News: I had to get a NYT Digital Subscription to figure out what's wrong.
Yesterday I posted a tweet with some feedback for the NY Times marketers. Getting a NYT Digital Subscription should open up something new and ...

Scripting News: Privacy is the sometimes wrong word.
You can talk about the security of your personal information in a different ways, each of which suggests a different set of issues. If I call ...

Don’t Take the Wrong Paths to Power
... it, and hoard it. If you have to bruise egos along the way, so what? No one will care or even remember how you got to the Don’t Take the Wrong ...

Resources last updated: 1/19/2016 10:20:54 PM