VBScript And Access 97

Results 1 to 2 of 2

Thread: VBScript And Access 97

  1. #1
    Manesh Gosai Guest

    Default VBScript And Access 97

    I&#039m having trouble connecting my Access 97 Database in VBScript. I have setup the ODBC Connection but i&#039m not sure how i should go about establishing a connection the database as well as doing things like Adding, Deleting and Updating to the database. If anyone can help me, it would be appreciated.<BR><BR>Regards<BR><BR>Manesh Gosai

  2. #2
    Join Date
    Dec 1969
    Posts
    18

    Default RE: VBScript And Access 97

    After you set up the ODBC connection, you can do the following which insert a user&#039s entry obtained from a form (i.e. Name field).<BR><BR>ConnString = "MyDatabaseDSN"<BR>Pwd=""<BR>Uid=""<BR><BR>set my_conn= Server.CreateObject("ADODB.Connection")<BR> my_Conn.Open "DSN=ConnString","",""<BR> StrSQl = "INSERT INTO tblUser (UserName) values (&#039" & Request.Form("Name") & "&#039)"<BR> my_conn.Execute StrSql<BR> my_conn.close<BR> set my_conn = nothing<BR><BR>Or instead of doing my_conn.execute StrSql, you can open up a real recordset such as<BR><BR>set rs=Server.CreateObject("ADODB.Recordset")<BR>rs.op en StrSQL, my_conn,adOpenStatic, adLockReadOnly<BR><BR>Be sure close the recordset and clear it from browser memory cache when you&#039re done.<BR><BR>You can consult a book to learn how to script the sql statement for deleting and updating records. It&#039s basically the same as the insert statement.<BR><BR>ld<BR>Hope this helps.<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
  •