473,395 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ASP NET and UpDATE Boolean to a n MDB

Hi,
I need to update a table in an mdb that has yes/no boxes. I can hard code a TRUE to the function but when I try and pass it I get an error which is saying type mismatch in criteria expression

This is my query string

Dim queryString As String = "UPDATE [Item] SET [Item_PO_number]=@Item_PO_number, [Controled_Item]=@Controled_I" & _
"tem, [Stock_Item]=@Stock_Item, [Consort]=@Consort, [Hours]=@Hours, [Partial_GR_I" & _
"tem]=@Partial_GR_Item, [Total_GR_Item]=@Total_GR_Item, [Items_Quantity]=@Items_Q" & _
"uantity WHERE (([Item].[Shopping_cart_Name] = '" & text1 & "') AND ([It" & _
"em].[Line_Number] = '" & text2 & "'))"

Please Help
Aug 5 '07 #1
4 3388
shweta123
692 Expert 512MB
Hi,

May be some columns from your table are numeric and you are passing string data to it.

e.g

WHERE (([Item].[Shopping_cart_Name] = '" & text1 & "') AND ([It" & _
"em].[Line_Number] = '" & text2 & "'))"

Here, try giving " & text2 & " , if Line_Number is numeric data type.
Aug 6 '07 #2
Thanks,
But itís not the variable itís the Boolean values Iíve tride it without them and it works fine.
Iím passing them over like this


Dim A As Boolean
Dim B As Boolean
Dim C As Boolean
Dim D As Boolean
Dim F As Boolean
Dim G As Boolean

ĎI then ste them to true or false

x = MyUpdateMethoditem2(txtShopingCartName.Text, txtLineNumber.Text, txtPONumber.Text, A, B, C, D, F, G, txtQuantity.Text)
Aug 6 '07 #3
jhardman
3,406 Expert 2GB
Here are a couple thoughts. First off, I prefer to open the db not with an "Update" statement like you do, the method I use involves opening a recordset with a "SELECT" statement, then modifying the values in the recordSet, then updating the db from the recordset. this goes something like this:
Expand|Select|Wrap|Line Numbers
  1. querystring = "SELECT * FROM myDBTable WHERE "
  2. querystring = querystring & "  '...whatever your complex where clause is
  3. set rs = server.createObject("adodb.recordset")
  4.  
  5. rs.open querystring, objConn, adOpenDynamic, adLockOptimistic
  6.  
  7. rs("boolA") = True
  8. rs("boolB") = False
  9. rs("boolC") = True
  10.  
  11. rs.update 
You see? This pulls the records in question into a local recordset object, you update the local object with the values you want, then just say rs.update to update the db from the recordset.

Second, I have noticed over time that every db wants booleans formatted differently. You say, "booleans can have formats?" and I say, "yeah, can you believe it?" for example, in SQL Server you need to send the booleans as integer 0, or anything else is saved as 1. It's been a while since I did an access db, but I thought access recognized vb booleans. If not, have you tried sending a string that says "true" or "false":
Expand|Select|Wrap|Line Numbers
  1.  rs("boolA") = "True"
? Let me know if this helps.

Jared
Aug 6 '07 #4
shweta123
692 Expert 512MB
Hi,

I think both of these statements work for Access database

sql = "Update Table1 set boolA = 0 where ....."
sql = "Update Table1 set boolA = 1 where ....."

OR

sql = "Update Table1 set boolA = false where ....."
sql = "Update Table1 set boolA = true where ....."


You can debug it by updating a single value query.
Aug 7 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: amitbadgi | last post by:
HI i am getting the foll error while conv an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Syntax error in UPDATE statement. Source Error: Line...
4
by: Jonathan Upright | last post by:
Greetings to anyone who can help: I'm using WebMatrix to make ASP.NET pages, and I chose the "Editable DataGrid" at the project selector screen. As you may know, it defaults to the Microsoft...
0
by: sdash | last post by:
I'm working on a simple formview screen that should update a SQL Server 2000 record. I'm sure there must be something simple wrong, but when I press update, the screen refreshes and the changes...
11
by: John | last post by:
Hi I had a working vs 2003 application with access backend. I added a couple fields in a table in access db and then to allow user to have access to these fields via app I did the following; ...
0
by: Luke | last post by:
Hello All, Using the following delegate, and attempting to update the UI. There is no clear examples on how to pass multiple parameters though to the dispatcher. I keep receiving an exception...
0
by: troyblakely | last post by:
I have a gridview which is pulling data from a SqlDataSource, the select command queries a view and the update command is a stored procedure. I'm using a stored procedure because several tables...
2
by: Looch | last post by:
Hi, I'm filling a GridView with a simple sproc select statement. I'm trying to use the Update tab to create an update statement and using the following: Update Shipping_Requests Set Shipped...
3
by: kpeeroo | last post by:
Private Function AddCompanyOvertime() As Integer Dim companyID As Integer = GetCompanyID() Console.WriteLine(companyID) Dim paramCompanyID As New SqlParameter("@CompanyID",...
2
by: bednarz.thomas | last post by:
I have the following business Object(s): public class ParentObject { public ParentObject(string somestring) { ...- } ....
1
by: Kunal101 | last post by:
Hi, Im trying to logically figure out how to update a record in a database through a web service to the database I have created this web method function but im stuck on completing this the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.