Simple connection problem - database doesn't u

Results 1 to 2 of 2

Thread: Simple connection problem - database doesn't u

  1. #1
    Join Date
    Dec 1969

    Default Simple connection problem - database doesn't u

    I&#039m very new to ASP so please bear with me :-)<BR><BR>I have a database that I want to add records to from a Web form using input buttons.<BR>I&#039ve downloaded many example databases with all the code already to go. Everything seems to work fine, except when I check the database for an updated record, none show up.<BR><BR>I used the ODBC Data Sources icon from the Windows 98 control panel and set the path of the .mdb file. The code that opens the database is there, with my database&#039s name in there too<BR>(for example, if my database and a table were named "email",<BR><BR>Response.Buffer = true<BR>dim cnn,rst<BR>set cnn = Server.CreateObject("ADODB.Connection")<BR>set rst = Server.CreateObject("ADODB.RecordSet")<BR>cnn.Open "driver={Microsoft Access Driver (*.mdb)};;DBQ=c:/inetpub/wwwroot/DataBases/email.mdb;"<BR>sqltext = "SELECT * FROM email"<BR>rst.Open sqltext,cnn,3,3<BR><BR> )<BR><BR>I don&#039t get any error messages. I just get nothing at all in the database. This is the same for every database and code I&#039ve downloaded thus far.<BR><BR>Any help is appreciated<BR><BR>-Ryan

  2. #2
    Baws Guest

    Default RE: Simple connection problem - database doesn

    Im not sure if this is the problem, but if thats all the code you&#039re using, you are not actually trying to update your db. You are only creating a recordset with everything that is in the table. You need to make the SQL an INSERT statement ie. INSERT INTO tablename. And then the values. Or maybe even using objRecordSet.AddNew, ie.<BR><BR>objRecordSet.Open<BR>objRecorset("field name") = "value"<BR>&#039and do this for all the data you want inserted and then<BR>objRecordSet.Update<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts