SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Senior Member
    Join Date
    Dec 2007
    Posts
    206
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    DataBase connection problem

    Hi, I have written some code to fetch data from database
    I am getting following error,I dont know where i am going wrong
    Set ocnn = CreateObject("ADODB.Connection")
    ' Set the Connection String.
    ocnn.ConnectionString = "DSN=RTB;NA=10.55.20.45,1531;DB=abc;UID=bus;PWD=bu s"
    ocnn.Open
    Set rcRecordSet= ocnn.Execute("select Name,COUNTRY from abc where Index=909358")
    ' Get all the fields from the data table (fields = Column Names).
    for each fields in rcRecordSet.fields
    DataTable.AddSheet("DataBase").AddParameter fields.Name, ""
    next
    ' Update the data table with the values from the database.
    rcRecordSet.MoveFirst
    iRow = 1
    do
    Datatable.SetCurrentRow iRow
    'DataTable.Value(" AcctStatus","DataBase") = rcRecordSet.fields("AcctStatus")
    DataTable.Value("name","DataBase") = rcRecordSet.fields("Name")
    DataTable.Value("COUNTRY", "DataBase") = rcRecordSet.fields("COUNTRY")
    iRow=iRow+1
    rcRecordSet.MoveNext
    loop until rcRecordSet.EOF
    By executing this i am getting following error

    Set ocnn = CreateObject("ADODB.Connection")
    ' Set the Connection String.
    ocnn.ConnectionString = "DSN=RTB;NA=10.50.15.101,1531;DB=qsubs2;UID=subs;P WD=subs"
    ocnn.Open
    Set rcRecordSet= ocnn.Execute("select Name,COUNTRY from SUBSCRIBER_PROFILE where SUBSCRIBER_ID=909358")
    ' Get all the fields from the data table (fields = Column Names).
    for each fields in rcRecordSet.fields
    DataTable.AddSheet("DataBase").AddParameter fields.Name, ""
    next
    ' Update the data table with the values from the database.
    rcRecordSet.MoveFirst
    iRow = 1
    do
    Datatable.SetCurrentRow iRow
    'DataTable.Value(" AcctStatus","DataBase") = rcRecordSet.fields("AcctStatus")
    DataTable.Value("name","DataBase") = rcRecordSet.fields("Name")
    DataTable.Value("COUNTRY", "DataBase") = rcRecordSet.fields("COUNTRY")
    iRow=iRow+1
    rcRecordSet.MoveNext
    loop until rcRecordSet.EOF

    [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed

  2. #2
    Senior Member
    Join Date
    Dec 2007
    Posts
    206
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: DataBase connection problem

    I get ride of the error "[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed " of the above code and now i am getting following error
    "Operation is not allowed when the object is closed."
    Why this error is comming.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 8.33%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 06:06 AM.

Copyright BetaSoft Inc.