OutFront Forums
     Home    Register     Search      Help      Login    

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

Sponsors
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

 

Inserting Session vars has me stumped

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Inserting Session vars has me stumped
Page: [1]
 
bdelahunty

 

Posts: 38
Joined: 10/15/2004
Status: offline

 
Inserting Session vars has me stumped - 5/29/2009 13:11:07   
I just can't figure out what I missed in this. The insert is going to MSAccess DB, all fields are integer. Error is datatype mismatch. Appreciate any help...

<%
Function ParseBody(strText)
End Function
Dim myConnString
Dim myConnection
Dim mySQL
myConnString = Application("fedex_ConnectionString")
Set myConnection = Server.CreateObject("ADODB.Connection")
myConnection.Open myConnString

mySQL= "INSERT INTO veh_parts "
mySQL= mySQL & "(veh_id,part_name_id,part_num_id) "
mySQL= mySQL & "VALUES ('" & Session("veh_id") & "','"
mySQL= mySQL & Session("part_name_id") & "','"
mySQL= mySQL & Session("part_num_id") & "')"
myConnection.Execute mySQL
myConnection.Close
Set myConnection = Nothing
%>

ou812

 

Posts: 1705
Joined: 1/5/2002
From: San Diego
Status: offline

 
RE: Inserting Session vars has me stumped - 5/29/2009 14:59:20   
I would first insure they're integers by displaying them prior to the query, just to double check. After that, you could try casting them with cint or clng if they're longer etc.

ex:
MySQL= mySQL & "VALUES ('" & clng(Session("veh_id")) & "','"
mySQL= mySQL & clng(Session("part_name_id")) & "','"
mySQL= mySQL & clng(Session("part_num_id")) & "')"


_____________________________

-brian

Black Holes suck.

EnterpriseDB: Enterprise-class relational database management system
PostgreSQL: The world's most advanced open source database

(in reply to bdelahunty)
bdelahunty

 

Posts: 38
Joined: 10/15/2004
Status: offline

 
RE: Inserting Session vars has me stumped - 5/29/2009 15:56:17   
doesn't help. I thought there was a different syntax item, ' or " etc, like putting # around date variables that was missing

(in reply to ou812)
Spooky

 

Posts: 26681
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Inserting Session vars has me stumped - 5/29/2009 20:31:52   
Do this first and tell us what the result is :

mySQL= "INSERT INTO veh_parts " 
mySQL= mySQL & "(veh_id,part_name_id,part_num_id) " 
mySQL= mySQL & "VALUES ('" & Session("veh_id") & "','" 
mySQL= mySQL & Session("part_name_id") & "','" 
mySQL= mySQL & Session("part_num_id") & "')"

response.write mySQL
response.end

myConnection.Execute mySQL 
myConnection.Close 
Set myConnection = Nothing 


It will show what SQL you are using. Normally a data mismatch occurs when you try and put the wrong data type in a database column.

eg :
If veh_id is numeric in the DB then you use quotes like so :

mySQL= mySQL & "VALUES (" & Session("veh_id") & ",'" 




_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to bdelahunty)
bdelahunty

 

Posts: 38
Joined: 10/15/2004
Status: offline

 
RE: Inserting Session vars has me stumped - 5/30/2009 14:50:55   
Yoe were right about one of the session vars being null. fixed that and this is the response...

INSERT INTO veh_parts (veh_id,part_name_id,part_num_id) VALUES ('9','20','47')

works now.

Thanks again!!

< Message edited by bdelahunty -- 5/30/2009 15:59:33 >

(in reply to Spooky)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Inserting Session vars has me stumped
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts