Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp page with parametrize query

Status
Not open for further replies.

teferi2002

Technical User
Sep 24, 2005
81
US
Hi all,
I am trying to create a simple asp.net page by passing a paramters with queries and eventually display the outcome to a datagrid.however,there is nothing display on the datagrid and i do not see any error msg either.Can someone look at my code and point me to the right direction.
thanks



<%@ Page Trace="False" Debug="True" Language="VB" %>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.OleDb"%>






<script runat="server">




Sub Button_Click(s as object , e as EventArgs)


Dim sConnect As String = "provider=MSDAORA;Data Source=xx;User ID=xx;Password=xx;"

'myConnection = new OleDbConnection(connectionString)
Dim oConnect As New OleDbConnection(sConnect)





Dim sSelect As String = "SELECT DISTINCT V.VENDOR, R.ADDRNUM, V.VNAMEL, R.AADDR1, R.ACITY, R.ASTATE FROM VENDOR V,VENDADDR R,PLANHOLD P WHERE V.VENDOR = R.VENDOR AND P.VENDOR = R.VENDOR AND R.ASTATE = '@state' "


Dim dr As OleDbDataReader

Dim oCommand As New OleDbCommand(sSelect, oConnect)
oCommand.Parameters.Add("@state", txtState.text)
oConnect.Open()
dr = oCommand.ExecuteReader()
dgrResult.DataSource = dr
dgrResult.DataBind()
oConnect.Close()

End Sub


</script>



<html>
<head>


<body>


<form id="frmMain" runat="server">
Enter State ID:
<asp:Textbox id="txtState" runat="server" />
<asp:Button id="btnSubmit" Text="Go" runat="server" />




<asp:DataGrid id="dgrResult" runat="server" autoGenerateColumns="false" cellpadding="4" width="100%">

<columns>
<asp:boundColumn DataField="VENDOR" HeaderText="Item Number"/>
<asp:boundColumn DataField="ADDRNUM" HeaderText="Short Description"/>
<asp:boundColumn DataField="VNAMEL" HeaderText="Long Description"/>
<asp:boundColumn DataField="AADDR1" HeaderText="Unit Name"/>

</columns>
</asp:DataGrid>


</form>

<span class="cite">
Testing to retrieve the right vendor list from Oracle data base.......
</span>

<hr />
</body>
</html>



 
Try debugging the application and step through the DataReader to make sure it is returning rows.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
thanks you ca8msm for your response.I am working on notepad and i do not have vs to do your suggestions.as i mentioned above i donot get any error message and it just brings back a blank page.
 
Try using something like the Web Matrix ( if you want a free debugger as then you can figure out what's going on for yourself.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top