VB -> SQL Server 
Author Message
 VB -> SQL Server

Hi,
    I am trying to manipulate a SQL server table via a web-gateway.  I
thought it would be a relatively simple task, but alas... Basically, the
problem I am having is when trying to create a temporary querydef (the
recommended way by microsoft!) I get a "not supported" error.  To get past
this, I just open the recordset with the SQL statement; works.  Of course,
however, since there is no querydef, there is no RecordsAfffected or
ReturnsRecords properties.  However when you use the INSERT INTO command, it
brings up a "cursor not valid" error - probably as there is no data to
display.  Can someone please point me in the right direction?

Thanks in advance!
    Duncan Welch


The code looks like this:

    Set ws = CreateWorkspace(Trim(User.sDSN), Trim(User.sUsername),
Trim(User.sPassword), dbUseODBC)
    Set db = ws.OpenDatabase("MyDatabase", , , "ODBC;DSN=" + Trim(User.sDSN)
+ ";UID=" + Trim(User.sUsername) + ";PWD=" + Trim(User.sPassword) + ";")
    Set rs = db.OpenRecordset(Trim(sSQL))

    SendCR "<P>SQL: " + sSQL + "</P>"
    Send Left(sDataLine, iPos - 1)

    SendCR "<table border=1 cellpadding=3>"

    Do Until rs.EOF
    SendCR "    <tr>"
        For iLoop = 0 To rs.Fields.Count - 1
            Send "        <td>"
            Send Trim(rs.Fields(iLoop).Value)
            SendCR "</td>"
        Next iLoop
        rs.MoveNext
    SendCR "</tr>"
    Loop

    SendCR "</table>"

    rs.Close
    db.Close
    ws.Close

    Set rs = Nothing
    Set db = Nothing
    Set ws = Nothing



Mon, 19 Feb 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Help with Find method using ODBC API cursors, VB -> SQL Server

2. sql server connect. Migration Access->sql server

3. sql server connect. Migration Access->sql server

4. sql server connect. Migration Access->sql server

5. Pass Data VB>SQL>ODBC>Oracle Database

6. SQL Server -> VB

7. VB Sql Server Via ADO Problem: [Microsoft][ODBC Sql Server Driver]

8. <<<`<<Is SQL SERVER supplied with Windows NT???>>>>>

9. VB->VBSQL.VBX->MS SQL Problem

10. VB->ODBC->SQL(NT) problem

11. Pessimistic Recordlocks Access --> SQL Server 6.5

12. recordset data -> temporary table (sql-server)

 

 
Powered by phpBB® Forum Software