ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 12th, 2011, 05:47 AM
swarv swarv is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Posts: 4 swarv User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 42 sec
Reputation Power: 0
Question Asp vbscript DB question.

Hi all,

I have this code:

Dim objConn, objRS, strQ, a, b, stsql, stuser, stpass, stadd, stpost, stfull

strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("\test\example.mdb")
Set objconnection = Server.CreateObject("ADODB.Connection")
objconnection.Open strConnection

stuser = request.form("username")
stpass = request.form("password")
stfull = request.form("fullname")
stadd = request.form("add")
stpost = request.form("postcode")
strSQL = "INSERT INTO members(username, pass, fullname) VALUES('" & stuser & "','" & stpass & "','" & stfull & "')"
objConnection.Execute strSQL



which works fine apart from its not adding the stfull part to the database. any ideas anybody?
If I take out the , fullname part it works fine.
the fullname is a field in the db.

the form code is:

<tr align="center">
<td width="248" height="17" bgcolor="#C0C0C0" align="right"><font color="#000000"><small>Add
Your Full Name:</small></font></td>
<td height="17" width="123" bgcolor="#C0C0C0" align="left"><input type="text"
name="fullname" size="50" tabindex="3" maxlength="8"></td>
<td width="47" height="17" bgcolor="#C0C0C0" align="center"><a
href="javascript:alert('The password must be between 4 and 8 characters long.')"><small><small>Help</small></small></a></td>
</tr>



thanks

Martin

Reply With Quote
  #2  
Old July 12th, 2011, 08:19 AM
swarv swarv is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Posts: 4 swarv User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 42 sec
Reputation Power: 0
?????????

I did a response.write and got this:

INSERT INTO members(username, pass, add) VALUES('uytr','67456546','546')

SQL looks ok to me.
Can anybody shed any light on please as its driving me nuts

thanks

Martin

Reply With Quote
  #3  
Old July 12th, 2011, 08:48 AM
Ronster Ronster is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Location: Charlotte
Posts: 412 Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 2 h 6 m 13 sec
Reputation Power: 143
Quote:
Originally Posted by swarv
I did a response.write and got this:

INSERT INTO members(username, pass, add) VALUES('uytr','67456546','546')

SQL looks ok to me.
Can anybody shed any light on please as its driving me nuts

thanks

Martin


Copy/paste that into a SQL window and run it.

Reply With Quote
  #4  
Old July 12th, 2011, 09:01 AM
swarv swarv is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Posts: 4 swarv User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 42 sec
Reputation Power: 0
Question works

Hi,

works fine in access in sql window.

any ideas on why it doesn't work in asp?

thanks

Reply With Quote
  #5  
Old July 13th, 2011, 08:11 AM
Ronster Ronster is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Location: Charlotte
Posts: 412 Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 2 h 6 m 13 sec
Reputation Power: 143
Quote:
Originally Posted by swarv
Hi,

works fine in access in sql window.

any ideas on why it doesn't work in asp?

thanks


Somethings wrong. In your code sample, you have this:
Code:
strSQL = "INSERT INTO members(username, pass, fullname) VALUES('" & stuser & "','" & stpass & "','" & stfull & "')"
objConnection.Execute strSQL


Yet in your response.write you say you're getting this:

Code:
INSERT INTO members(username, pass, add) VALUES('uytr','67456546','546')


How is that possible, that "fullname" is now "add" (the parts I bolded) ?

The other thing you could do is some error trapping, to see if an error is being generated. Do a Google for:
Code:
classic asp error handling


I found this:
http://stackoverflow.com/questions/472558/is-try-catch-like-error-handling-possible-in-asp-classic

Reply With Quote
  #6  
Old July 13th, 2011, 09:05 AM
swarv swarv is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Posts: 4 swarv User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 42 sec
Reputation Power: 0
hi

Hi,

that must have been a typo, i probably was trying different fields before i did the reponse.write.

I'll have a look at error trapping now. It is a strange one.

Reply With Quote
  #7  
Old July 14th, 2011, 11:17 AM
RG-FMAG RG-FMAG is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Posts: 2 RG-FMAG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 56 sec
Reputation Power: 0
Could you post your table structure?
In the past I've had random intermittent issues with Memo fields in the past and it might be something there.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Asp vbscript DB question.

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap