Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Section of Code that read an xml file for an Sql Query. the code work fine but no rows returned..i tried the same query on Access database it return rows

HTML
----
<Test>
<TR_PARAM>MATERIALISSUE</TR_PARAM>
<TR_QUERY>SELECT SERIALNO,ISSUEDATE,SALESORDERCODE,INVITEMCODE,QTY,UNITCODE,POSITEMCODE,ITEMTYPE,SERVINGUNITCODE,SERVINGQTY,REFSERIALNO ,@P3 FROM MATERIALISSUE WHERE (ISSUEDATE &gt;@P1 AND ISSUEDATE &lt;@P2)</TR_QUERY>
<TR_FREEZ>N</TR_FREEZ>
<TR_PARAM1>7:7</TR_PARAM1>
<TR_NO_PARAM>3</TR_NO_PARAM>
<TR_DEF_UPLOAD>Y</TR_DEF_UPLOAD>
<TR_TYP_2>0</TR_TYP_2>
<TR_TYP_3>FD:TDT</TR_TYP_3>
<TR_TYP_4>100</TR_TYP_4>
</Test>


VB.net Code
-------------
tblname = dro("tr_param")
Dim cmd As New OleDbCommand(dro("tr_query"), cnn)
Dim arrctl() As String = Split(dro("TR_TYP_3"), ":")
Dim arrpr() As String = Split(dro("tr_param1"), ":")
For i As Byte = 0 To dro("TR_NO_PARAM") - 1
If i = 2 Then
Dim P3 As New OleDbParameter("@P3", Locname)
P3.Value = Locname
cmd.Parameters.Add(P3)
Else
Dim p As New OleDbParameter("@P" & i + 1, arrpr(i))

p.Value = IIf(arrctl(i) = "FD", dtpfrom.Text, IIf(arrctl(i) = "TDT", dtpTo.Text, ""))
cmd.Parameters.Add(p)
End If
Next
Dim dts As New DataTable(dro("tr_param"))
dts.Load(cmd.ExecuteReader)



'Note take Value of P3 as "DBMALU" read from another text file
Posted

1 solution

Newsflash - your inability to do your job, is not urgent for us.

Have you stepped through the code and confirmed the SQL that you end up generating ? Perhaps if you use your debugger and read the SQL you're running, you can try running it in SQL Server and work out from there why your SQL is broken ?
 
Share this answer
 
Comments
Sandeep Mewara 28-Jul-10 7:53am    
Comment from OP: @Christian
Thnks 4 ur reply
The Qrys Work fine but no use same result
have any other soln

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900