Graeme McGilvray
asked on
Issues with Insert statement
Hi there! I am having issues with this particular insert statement.
for some reason is wont write it to the database nor shows an error either
I thought the IF statement prior to this was not working, however I have tested it and it works fine, just this below doesnt...
Please ask questions away, just need to figure this out
Thanks
for some reason is wont write it to the database nor shows an error either
I thought the IF statement prior to this was not working, however I have tested it and it works fine, just this below doesnt...
oConn.Execute("INSERT INTO site_sessions(session_ID,brand_ID,session_IP,session_geoCity,session_geoCountry,session_timezone,session_date,session_curr,session_rate) VALUES("&Session.SessionID&",'"&SubDomain("brand_options.brand_ID")&"','"&RemoteIP&"','"&CityLoc&"','"&CountryLoc&"',"&Timezone&",'"&Now()&"','"&ClientCurr&"',"&ClientConvert&")")
Please ask questions away, just need to figure this out
Thanks
quick try:
make sure if your field is a char field, we need to encapsulate the value with single quotes
oConn.Execute("INSERT INTO site_sessions(session_ID,brand_ID,session_IP,session_geoCity,session_geoCountry,session_timezone,session_date,session_curr,session_rate) VALUES("&Session.SessionID&",'"&SubDomain("brand_options.brand_ID")&"','"&RemoteIP&"','"&CityLoc&"','"&CountryLoc&"',"&Timezone&", Now() ,'"&ClientCurr&"',"&ClientConvert&")")
make sure if your field is a char field, we need to encapsulate the value with single quotes
oConn.Execute("INSERT INTO site_sessions(session_ID,brand_ID,session_IP,session_geoCity,session_geoCountry,session_timezone,session_date,session_curr,session_rate) VALUES("& Session.SessionID & "," & SubDomain("brand_options.brand_ID") & ",'" & RemoteIP & "','" & CityLoc & "','" & CountryLoc & "'," & Timezone & ",'" & Now() & "','" & ClientCurr & "'," & ClientConvert & ")")
ASKER
Hi Shaun, Brand_ID is char
Ryan, tried that, still no joy
-yeah gone thru them all prior found some single quotes in timezone where that is a number... was fixed then posted this question as it is still not working :(
Ryan, tried that, still no joy
-yeah gone thru them all prior found some single quotes in timezone where that is a number... was fixed then posted this question as it is still not working :(
@Graeme
try to response out the SQL so that we can verify that. also make sure you do not have single quote in your insert values? if yes then you need to double the single quote to escape the value.
try to response out the SQL so that we can verify that. also make sure you do not have single quote in your insert values? if yes then you need to double the single quote to escape the value.
SQL = "INSERT INTO site_sessions(session_ID,brand_ID,session_IP,session_geoCity,session_geoCountry,session_timezone,session_date,session_curr,session_rate) VALUES("&Session.SessionID&",'"&SubDomain("brand_options.brand_ID")&"','"&RemoteIP&"','"&CityLoc&"','"&CountryLoc&"',"&Timezone&",'"&Now()&"','"&ClientCurr&"',"&ClientConvert&")"
Response.write SQL
Response.end
oConn.Execute(SQL)
ASKER
INSERT INTO site_sessions(session_ID,brand_ID,session_IP,session_geoCity,session_geoCountry,session_timezone,session_date,session_curr,session_rate) VALUES(469735566,'GPT','49.196.168.130','Perth','AU',8,'16/01/2017 10:08:49','AUD',1.337704)"
ASKER
As a new session you can see the output for yourself
dev.gptouring.com.au
Scroll up to see the new session information
dev.gptouring.com.au
Scroll up to see the new session information
INSERT INTO site_sessions(session_ID,brand_ID,se ssion_IP,s ession_geo City,sessi on_geoCoun try,sessio n_timezone ,session_d ate,sessio n_curr,ses sion_rate) VALUES(469735566,'GPT','49 .196.168.1 30','Perth ','AU',8,' 16/01/2017 10:08:49','AUD',1.337704)"
looks ok.... what if you manually execute this insert statement into your database (Access if not wrong?), what error did you get here?
you may also manually test this and see if you got any error?
INSERT INTO site_sessions(session_ID,brand_ID,session_IP,session_geoCity,session_geoCountry,session_timezone,session_date,session_curr,session_rate) VALUES(469735566,'GPT','49.196.168.130','Perth','AU',8, now() ,'AUD',1.337704)
ASKER
Hi Ryan, tried my output and your output, no errors... no insert done
Question...
-Is there a max amount of records that can be held in a table? currently in that table there is 9062
Question...
-Is there a max amount of records that can be held in a table? currently in that table there is 9062
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
maybe you have error handling turned off, put the following line right above the insert statement:
on error goto 0
this will reset it in case you have on error resume next somewhere on your page
on error goto 0
this will reset it in case you have on error resume next somewhere on your page
ASKER
Have gone thru and found 2 letters back to front on my end :/
Thanks for the debug!
Thanks for the debug!
Open in new window