Results 1 to 3 of 3

Thread: ODBC - SQL Server

  1. #1

    Thread Starter
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    Question

    Hi. I'm not really a schollar in this subject. That's why I'm kind of learning while programming. This is the problem I have. I connect my APP to Microsoft SQL Server 7.0 through ODBC.

    Code:
         Dim DSN As String, UID As String, DBF As String   
       
         DSN = String$(255, 0)
         UID = String$(255, 0)
         DBF = String$(255, 0)    
         connect$ = "ODBC;DSN=academica32;UID=sa;DATABASE=academica"
         Set db = OpenDatabase("", False, False, connect$)
         db.QueryTimeout = 20000
    Then I make the queries I need with no problem. However I can not insert new info in my tables. This is how I'm trying

    Code:
         Set rs = db.OpenRecordset(SQLStatement, dbOpenDynaset, dbSQLPassThrough)
    where SQLStatement is a string variable, and its value is the query statement. Aparently there's no problem with the statement, because if I send the SQLStatement to the clipboard and paste it in Microsoft ISQL/W seems to work. At least, the info is added. Has anybody any idea?. Here is the "table definition" and an example of the SQLStatement I tried:


    Definition:
    Code:
    CREATE TABLE fnl (nu_lega varchar(7) NOT NULL,
                      co_mate varchar(6) NOT NULL,
                      nu_libro varchar(3) NOT NULL,
                      nu_folio varchar(3) NOT NULL,
                      fe_exa datetime NULL,
                      no_exa varchar(2) NULL,
                      fl_fnl_tpa varchar(1) NOT NULL,
                      co_espe varchar(2) NOT NULL,
                      co_curso varchar(5) NULL,
                      an_lectivo varchar(4) NULL,
                      co_estado varchar(2) NULL,
                      co_control varchar(21) NULL)
    SQLStatement example
    Code:
    INSERT INTO fnl_tpa VALUES ('1053840',
                                '954444',
                                '95444',
                                '250',
                                CONVERT (varchar(16), '05/22/2000' ,113),
                                NULL,
                                'T',
                                'R',
                                'R4444',
                                '2000',
                                '1',
                                'Emiliano')

    Why this "query" does work on Microsoft ISQL/w but doesn't on my APP??
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  2. #2

    Thread Starter
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    Lightbulb

    I think I've already found one problem.

    nu_libro is 3 character long and I'm trying to "paste" a 5 char long. I'll get the table correct and retry it. I'll tell you if I "succeed".
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  3. #3

    Thread Starter
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    Cool

    Yeah, that was the problem. It's already working. Thanx anyway.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

Posting Permissions

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



Click Here to Expand Forum to Full Width