problem using ADO

Angelo
Member Posts: 180
Hello all,
I have a problem when using ADO connection. my code be like this :
IF ISCLEAR(ADOConn) THEN
CREATE(ADOConn);
ConnStr := STRSUBSTNO('%1',
'Provider=Microsoft.Jet.OLEDB.4.0;' +
'Data Source=C:\xxx\ yyy.mdb;Persist Security Info=False');
ADOConn.Open(ConnStr);
CREATE(ADORec);
// Insert
SQLStr :=
'INSERT INTO [DRAWINGS] (' +
'[ID], ' +
'[GROUP_ACCOUNT], ' +
'[ACCOUNT_NO], ' +
'[CARD_NO], ' +
'[CUSTOMER_NAME]) VALUES (' +
'''' + id + ''',' +
'''' + grpacc + ''',' +
'''' + accno + ''',' +
'''' + crdno + ''',' +
'''' + custname + ''')';
ADOConn.Execute(SQLStr);
ADOConn.Close;
CLEAR(ADORec);
CLEAR(ADOConn);
When I try to Run there is error like this :
"Overflow under type coversion text to text ......"
My Navision table :
ID - text 50
Group account - text 50
Account no - text 50
card no - text 50
customer name - text 30
My Access table :
ID - Number
Group account - text 50
Account no - text 50
card no - text 50
customer name - text 30
Anyone can tell me how to solve the problem?
regards,
Angelo
I have a problem when using ADO connection. my code be like this :
IF ISCLEAR(ADOConn) THEN
CREATE(ADOConn);
ConnStr := STRSUBSTNO('%1',
'Provider=Microsoft.Jet.OLEDB.4.0;' +
'Data Source=C:\xxx\ yyy.mdb;Persist Security Info=False');
ADOConn.Open(ConnStr);
CREATE(ADORec);
// Insert
SQLStr :=
'INSERT INTO [DRAWINGS] (' +
'[ID], ' +
'[GROUP_ACCOUNT], ' +
'[ACCOUNT_NO], ' +
'[CARD_NO], ' +
'[CUSTOMER_NAME]) VALUES (' +
'''' + id + ''',' +
'''' + grpacc + ''',' +
'''' + accno + ''',' +
'''' + crdno + ''',' +
'''' + custname + ''')';
ADOConn.Execute(SQLStr);
ADOConn.Close;
CLEAR(ADORec);
CLEAR(ADOConn);
When I try to Run there is error like this :
"Overflow under type coversion text to text ......"
My Navision table :
ID - text 50
Group account - text 50
Account no - text 50
card no - text 50
customer name - text 30
My Access table :
ID - Number
Group account - text 50
Account no - text 50
card no - text 50
customer name - text 30
Anyone can tell me how to solve the problem?
regards,
Angelo
0
Comments
-
How long is SQLStr variable? How is defined? It seems that you have too short variable to keep the command...0
-
Your variable SQLStr should be to short.Do you make it right, it works too!0
-
Hello,
due to string limit in Nav, try execute sql query directly in AdoConn.Execute function.
For better understanding try using Text constant with strsubstno function.
Make some constant like SQLSTR with text:
INSERT INTO [DRAWINGS] ([ID],[GROUP_ACCOUNT], [ACCOUNT_NO],[CARD_NO],[CUSTOMER_NAME]) VALUES ('%1','%2','%3','%4','%5')
And then use this const likeAdoconn.execute(STRSUBSTNO(SQLSTR,id,grpacc,accno,crdno,custname));
Hope it helps.
Br,
Igor Beeone0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions