Urgent! Using AddNew Method of ADO

Results 1 to 5 of 5

Thread: Urgent! Using AddNew Method of ADO

  1. #1
    Vipul Desai Guest

    Default Urgent! Using AddNew Method of ADO

    Can someone please help me out with an actual example that works<BR>for adding a record to an Access Database. Is it me (I don&#039t think it is) or is it that ADO is an absolute piece of garbarge!<BR>I have never had this problem with DAO, RDO or Oracle Objects For OLE. I have something below that should work!<BR><BR>Thanks<BR>&#060;%<BR>Dim ADOConn<BR>Dim Daoconn<BR>dIM RS<BR>dim count<BR>Set ADOCOnn = CreateObject("Adodb.Connection") <BR>Set RS = CreateObject("ADODB.REcordSEt") &#039<BR>AdoConn.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=c est.MDB" <BR><BR>RS.Open "collapsed",adoConn,adOpenDynamic<BR><BR><BR><BR>r s.addnew<BR>RS("LName") = "DESAI"<BR>RS("FName") = "Vipul"<BR>RS.update<BR>Response.WRite Err.Description<BR>%&#062;<BR>&#039Program Crashes Here Noting That the Provider Does Not <BR>&#039Support This Request<BR><BR><BR>

  2. #2
    Jagdish Dhobley Guest

    Default ADO is great Handle With Care

    I hope this works for u. ADO is not like DAO or RDO. It is more powerful and can do anything u can think of.<BR><BR><BR>RS.Open strSQL,LocalConnection,adOpenKeyset,adLockOptimist ic,1<BR>RS.AddNew<BR>RS.Fields(0).Value = "Jagdish"<BR>RS.Fields(1).Value = "Dhobley"<BR>RS.Update

  3. #3
    Vipul Desai Guest

    Default RE: DID NOT WORK:: Addnew Method Of ADO recordset

    The following is some code that I have been using with trying<BR>to add a record to an Access Database. I am getting an error that states that "the Provider does not support this function."<BR><BR><BR><BR>&#060;%@EnableSessionSta te=True Language=VBScript%&#062; <BR>&#060;! -- #Include File = "c:Progra~1Common~1SystemadoADOVBS.INC"--&#062; <BR>&#060;HTML&#062;<BR>&#060;BODY bgColor=CLAY&#062;<BR>&#060;% Call AddLogisticsNumbers %&#062;<BR><BR>&#060;% Sub AddLogisticsNumbers<BR><BR>aDim ADOConn<BR>Dim ADORS<BR>dim AdOpenDynamic <BR>adOpenDynamic = 3<BR><BR>Set ADOCOnn = Server.CreateObject("AdoDB.Connection") <BR>ADOConn.Open "Provider = Microsoft.Jet.OLEDB.4.0;data source=C:
    ew.mdb"<BR><BR>Set adors = Server.CreateObject("ADODB.Recordset") <BR><BR>ADORS.Open "Mother", adoCOnn,3<BR><BR> <BR><BR>ADORS.AddNew<BR>ADORS("product") = "This is a test"<BR><BR>ADORS.update<BR>Response.Write Err.description<BR><BR><BR><BR><BR><BR><BR><BR><BR >End Sub<BR>%&#062;<BR>&#060;p&#062;<BR>&#060;/HEAD&#062;<BR>&#060;/BODY&#062; <BR>&#060;/HTML&#062;<BR><BR>

  4. #4
    Keith Fowler Guest

    Default RE: DID NOT WORK:: Addnew Method Of ADO recordset

    Might I suggest that you begin using &#060;%Option Explicit%&#062;.<BR><BR>Many of your variables are different.<BR>such as<BR>Dim ADORS<BR><BR>and adors<BR><BR>By using Option Explicit you can solve part of your problem.<BR>Use it Faithfully!!!!

  5. #5
    Join Date
    Dec 1969

    Default RE: Urgent! Using AddNew Method of ADO

    Here is the code that will never crash....sno matter what database you use...I have assumed that you have created an application level connection object<BR><BR>To create an appl. level connection object use the following code in you global.asa file<BR><BR>Application On_Start()<BR>Set Application("DBObj")=server.createobject("ADODB.Co nnection")<BR>Application("DBOBJ").Open "yourconnectionstring"<BR><BR>End Sub<BR><BR>Then in the asp file where you want to add records....use the foll code<BR><BR>If not IsEmpty(RS) then set RS=nothing<BR>set RS=server.createobject("adodb.recordset")<BR>RS.ac tiveconnection=application("dbobj")<BR>RS.cursorty pe=1<BR>RS.LockType=3<BR>RS.source="Select * from sometable where somecondition"<BR>RS.Open<BR>RS.Addnew<BR><BR>RS.f ields("somefield")=somevariable<BR>RS.fields("anot herfield")=anothervariable<BR>RS.Update<BR>set RS=nothing<BR><BR>My e-mail address is dnilesh@wilnetonline.net<BR><BR>I can solve many a problems for you. Please let me have them. Please also tell your friends about this.

Posting Permissions

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