kennysflau
asked on
SQL problem
I generate a SQL dynamically in my code:
strSQLMax = "SELECT MAX(SeqNo) AS MaxSeqNo FROM " + strInfoTable + " WHERE PartsNo LIKE '" + PartsNo + "*';"
the output string of strSQLMax is:
"SELECT MAX(SeqNo) AS MaxSeqNo FROM myTable WHERE PartsNo LIKE 'Parts-No-*';"
And I tried to copy the output string and run it directly on my *.mdb, the SQL works.
However, I cannot run it with "myAdaptor.Fill(myDataSet )"... it just ignore the "Parts-No-*" and could not find any record
Is it a bug of ASP.Net?
Please help!!! It's urgent!!!
strSQLMax = "SELECT MAX(SeqNo) AS MaxSeqNo FROM " + strInfoTable + " WHERE PartsNo LIKE '" + PartsNo + "*';"
the output string of strSQLMax is:
"SELECT MAX(SeqNo) AS MaxSeqNo FROM myTable WHERE PartsNo LIKE 'Parts-No-*';"
And I tried to copy the output string and run it directly on my *.mdb, the SQL works.
However, I cannot run it with "myAdaptor.Fill(myDataSet )"... it just ignore the "Parts-No-*" and could not find any record
Is it a bug of ASP.Net?
Please help!!! It's urgent!!!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try this
idont know if u r using vb or c# anyway...
string temp="";
temp=PartsNo;
temp=temp+"*";
strSQLMax = "SELECT MAX(SeqNo) AS MaxSeqNo FROM " + strInfoTable + " WHERE PartsNo LIKE '" + temp + "';"
idont know if u r using vb or c# anyway...
string temp="";
temp=PartsNo;
temp=temp+"*";
strSQLMax = "SELECT MAX(SeqNo) AS MaxSeqNo FROM " + strInfoTable + " WHERE PartsNo LIKE '" + temp + "';"
ASKER
It will not wor... as the output string is just the same...
I've tried it anyway... no luck
I've tried it anyway... no luck
are you sure it is not finding any record?? or not displaying any record??
if not displaying it may be a problem with viewstate..it has to do with the life cycle of ASP.NET page..
?
if not displaying it may be a problem with viewstate..it has to do with the life cycle of ASP.NET page..
?
ASKER
I changed it to hard code then it worked
I guess it should not be the viewstate problem
I guess it should not be the viewstate problem
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
kennysflau
can you clarify why you chose my answer as assisting answer and not acceped one.????!!
can you clarify why you chose my answer as assisting answer and not acceped one.????!!
ASKER
Because the link provided by carl tawn explains the reason behind the solution. If you see my question, my question is "Is it a bug of ASP.Net?".... I prefer a reason rather than the solution only. But really thank you very much for helping!
ok thanks anyway
:)
:)
ASKER
Parts-No-* = Parts-No- + unlimited unknown char
Parts-No-% = Parts-No- + ONE unknown char