HighDots Forums  

Updating Database with ASP

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Updating Database with ASP in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mithrandir webforumsuser@macromedia.com
 
Posts: n/a

Default Updating Database with ASP - 07-15-2003 , 11:38 PM






Hi,

I'm just learning how to use ASP and I've been trying to figure out how to add records to my database.

I'm learning it out of a book and have been following the code in the book except IT DOESNT WORK!!!!

I have no idea why. It's maddening!

My update code is attached for your kindly inspection.

Thanks for whatever help you can provide. I'll need it.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>

<%
Dim Connect, msgRS, Query
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "appData1"
Set msgRS = Server.CreateObject("ADODB.Recordset")
Query = "SELECT * FROM helloWorld"
msgRS.Open Query, Connect, adOpenStatic, _
adLockOptimistic

msgRS.AddNew
msgRS("name") = "John Doe"
msgRS("Message") = "Ya did a great jeaoaearb there!"
msgRS.Update
%>

------------------
All that is gold does not glitter
Not all who wander are lost . . .

-- J. R. R. Tolkien


Reply With Quote
  #2  
Old   
Paul Whitham TMM
 
Posts: n/a

Default Re: Updating Database with ASP - 07-15-2003 , 11:48 PM






All your code is doing is reading all the records from a table called
HelloWorld. You need an insert statement to write to it.

Rather than trying to hand code it, I would look at upgradings to DMX, as
all this functionality is built in.

--
Regards

Paul Whitham
Valleybiz Internet Design
www.valleybiz.net

Team Macromedia Volunteer for Ultradev/Dreamweaver MX
www.macromedia.com/support/forums/team_macromedia
"Mithrandir" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
Hi,

I'm just learning how to use ASP and I've been trying to figure out how to
add records to my database.

I'm learning it out of a book and have been following the code in the book
except IT DOESNT WORK!!!!

I have no idea why. It's maddening!

My update code is attached for your kindly inspection.

Thanks for whatever help you can provide. I'll need it.
%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%
% Option Explicit %

%
Dim Connect, msgRS, Query
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "appData1"
Set msgRS = Server.CreateObject("ADODB.Recordset")
Query = "SELECT * FROM helloWorld"
msgRS.Open Query, Connect, adOpenStatic, _
adLockOptimistic

msgRS.AddNew
msgRS("name") = "John Doe"
msgRS("Message") = "Ya did a great jeaoaearb there!"
msgRS.Update
%

------------------
All that is gold does not glitter
Not all who wander are lost . . .

-- J. R. R. Tolkien




Reply With Quote
  #3  
Old   
Vivian Mark
 
Posts: n/a

Default Re: Updating Database with ASP - 07-16-2003 , 04:05 AM



Go to www.webthang.co.uk , there is a tutorial on ASP using DWMX. Really
easy.

cheers
vivian


"Mithrandir" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
Hi,

I'm just learning how to use ASP and I've been trying to figure out how to
add records to my database.

I'm learning it out of a book and have been following the code in the book
except IT DOESNT WORK!!!!

I have no idea why. It's maddening!

My update code is attached for your kindly inspection.

Thanks for whatever help you can provide. I'll need it.
%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%
% Option Explicit %

%
Dim Connect, msgRS, Query
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "appData1"
Set msgRS = Server.CreateObject("ADODB.Recordset")
Query = "SELECT * FROM helloWorld"
msgRS.Open Query, Connect, adOpenStatic, _
adLockOptimistic

msgRS.AddNew
msgRS("name") = "John Doe"
msgRS("Message") = "Ya did a great jeaoaearb there!"
msgRS.Update
%

------------------
All that is gold does not glitter
Not all who wander are lost . . .

-- J. R. R. Tolkien




Reply With Quote
  #4  
Old   
Ron
 
Posts: n/a

Default Re: Updating Database with ASP - 07-16-2003 , 01:43 PM



I wanted to ask you about the code you used:

1) Is your DSN named "appData1"
2) Is your database table named "helloWorld"
3) Is the field in that table named "name", and "Message

I know your just getting started with ASP, but just wanted to make sure that
those are correct.

--
Ron



Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.