Hi, Dieter,
I understand that you encountered the Geman error message when you usd the
statement:
" insert into FACFG_SML_IDX
(FACFG_SML_IDX.WERK_ID,FACFG_SML_IDX.SML_ID,FACFG_ SML_IDX.LAST_INDEX)
values
(?,?,0)" in SQLDescribeParam; however it succeeded when you used " insert
into FACFG_SML_IDX (WERK_ID,SML_ID,LAST_INDEX) values (?,?,0)".
If I have misunderstood, please let me know.
Appreciate your understanding that our MSDN Managed Newsgroups are focused
on English language support. It will be able to let us better understand
your issue clearly if you could do some translation in your future posts.
Anyway, after compare the following two articles:
http://msdn2.microsoft.com/de-de/library/33xdxt7x(vs.80).aspx
http://msdn2.microsoft.com/en-us/library/33xdxt7x(vs.80).aspx
, I know that the corresponding english meaning is "Attempted to read or
write protected memory. This is often an indication that other memory has
been corrupted".
I will write a test project to see if I can reproduce your issue and I will
let you know as soon as possible. Also, since the error indicates that this
is a memory related issue, you may also carefully check if there are some
array overflow issues.
Best regards,
Charles Wang
Microsoft Online Community Support
================================================== ===
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications
If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
================================================== ====
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====
Hi, Dieter,
Never mind! I have received your email response. Also, I just get a
response from a person; however he would like to know if my code was same
as yours. I would like to attach my code here and if there is anything
different from yours, please let me know.
================================================== ==========================
==
SQLHENV henv;
SQLHDBC hdbc;
SQLHSTMT hstmt;
SQLPOINTER rgbValue=NULL;
SQLRETURN retcode;
SQLWCHAR ConnStrOut[MAXBUFLEN];
SQLSMALLINT cbConnStrOut = 0;
SQLSMALLINT NumParams, i, DataType, DecimalDigits, Nullable;
SQLUINTEGER ParamSize;
SQLINTEGER ParamLenArray[2];
SQLWCHAR Statement[1000];
WCHAR retstr[10];
SQLWCHAR* PtrArray[2];
/*Allocate environment handle */
retcode = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
/* Set the ODBC version environment attribute */
retcode = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION,
(void*)SQL_OV_ODBC3, 0);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
/* Allocate connection handle */
retcode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
/* Set login timeout to 5 seconds. */
SQLSetConnectAttr(hdbc, SQL_LOGIN_TIMEOUT,(SQLPOINTER*)5, 0);
/* Connect to data source */
retcode = SQLConnect(hdbc, (SQLWCHAR*) L"myWOW", SQL_NTS,
(SQLWCHAR*) L"sa", SQL_NTS,
(SQLWCHAR*) L"Password1!", SQL_NTS);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO){
/* Allocate statement handle */
retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
{
/* Process data */
WCHAR strStm[100]=L"INSERT INTO
ANT([ANT].[NAME],[ANT].[DESCRIPTION]) values (?,?)";
wcscpy(Statement,strStm);
retcode = SQLPrepare(hstmt, Statement,
SQL_NTS);
// Check to see if there are any parameters.
If so, process them.
SQLNumParams(hstmt, &NumParams);
if (NumParams) {
for (i = 0; i < NumParams; i++) {
SQLDescribeParam(hstmt, i+1, &DataType,
&ParamSize, &DecimalDigits, &Nullable);
PtrArray[i]=(SQLWCHAR *) malloc(50);
wcscpy(PtrArray[i],L"ABCDE");
SQLBindParameter(hstmt, i + 1,
SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WCHAR, 4,
0, PtrArray[i],
0,&ParamLenArray[i]);
}
// Execute the statement.
retcode = SQLExecute(hstmt);
free(PtrArray[0]);
free(PtrArray[1]);
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
}
SQLDisconnect(hdbc);
}
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
}
}
SQLFreeHandle(SQL_HANDLE_ENV, henv);
}
}
================================================== ==========================
================
If it is convenient for you, I recommend that you mail me a test project of
yours and I will forward to him.
Best regards,
Charles Wang
Microsoft Online Community Support
================================================== ===
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications
If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
================================================== ====
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====
|||Hi, Dieter,
I got another two responses from the product team. I would like to forward
them to you for your reference.
================================================== ==========================
==
My book "A Guide to the SQL Standard" states this:
The general syntax is:
INSERT INTO table [ (column-commalist) ] source
Where "table" identifies the target table, the identifiers in parentheses
identify some or all of the columns of that table (by their unqualified
column names)
Italics are in the book to emphasize the names must be unqualified. So as
I was discussing with Warren the other day - I don't believe this is valid
syntax and probably should error. Reasonable consumers should not expect
this to work. However, if we have let them get away with it in the past we
may be stuck with some support.
================================================== ==========================
==
There is some ambiguity here as to what is semantically correct. As an
example:
INSERT INTO [MyDB].[dbo].[Table1]
([Table1].[col1]
,[Table1].[col2]
,[SomeOtherTableThatMayOrMayNotExist].[col3]
,[Table1].[col4])
VALUES
(?, ?, ?, ?)
One wouldn't normally expect this query to work, yet it doesin fact, you
can put any n-part name on any of these columns in the query list and it
will still work so long as the column specifier identifies a column in the
table specified by the object name portion.
Which brings up some interesting secondary questionsfor instance, what
does OLEDB do with this query string when GetParameterInfo is called? Does
it know to remove the table portion from the column specifier? Should
ODBC/OLEDB error on SQLDescribeParam/GetParameterInfo with this query or
should they silently strip the table portion from the column specifier as
does the engine? I'm on a separate thread with some guys from the engine to
debate these pointswill follow up here once that's known.
================================================== ==========================
==
Based on the two responses, I think that it is reasonable that column name
should not be used with table name in ODBC Driver.
Hope this helps.
If you have any other questions or concerns, please feel free to let me
know.
Best regards,
Charles Wang
Microsoft Online Community Support
No comments:
Post a Comment