PDA

Click to See Complete Forum and Search --> : ODBC - SQL Server


Mc Brain
May 21st, 2000, 10:14 PM
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.


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


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:

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

INSERT INTO fnl_tpa VALUES ('1053840',
'954444',
'95444',
'250',
CONVERT (varchar(16), '05/22/2000' ,113),
NULL,
'T',
'R',
'R4444',
'2000',
'1',
'Emiliano')

:confused:
Why this "query" does work on Microsoft ISQL/w but doesn't on my APP?? :confused:

Mc Brain
May 21st, 2000, 10:28 PM
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". ;)

Mc Brain
May 21st, 2000, 11:46 PM
Yeah, that was the problem. It's already working. Thanx anyway. :)