B
Brad Baker
I am trying to write a simple ASP.net/C# page which allows users to select
some values and produce a report based on a SQL query.
I have a self posting dropdown form which allows users to select the type of
report to generate:
Select the type of report to display:
<form runat="server">
<aspropDownList AutoPostBack="true" ID="report" runat="server">
<asp:listitem>Report Type 1</asp:listitem>
<asp:listitem>Report Type 2</asp:listitem>
<asp:listitem>Report Type 3</asp:listitem>
<asp:listitem>Report Type 4</asp:listitem>
<asp:listitem>Report Type 5</asp:listitem>
<asp:listitem>Report Type 6</asp:listitem>
</aspropDownList>
</form>
I am trying to write some conditional logic which determines which SQL query
will be run:
<script language="c#" runat="server">
public void Page_Load(object sender, EventArgs e) {
if (report.SelectedItem.Text == null) OR (report.SelectedItem.Text ==
"Report Type 1") {
string sql_query = "SQL QUERY";
}
// RUN THE QUERY
}
</script>
Unfortunately I keep getting the following error: Compiler Error Message:
CS1002: ; expected on the following line:
if (report.SelectedItem.Text == null) OR (report.SelectedItem.Text ==
"Report Type 1") {
I am sure this is a problem with my syntax but I'm just having problems
determining the correct syntax to use. Could anyone offer any pointers or
references to documentation?
Thanks in Advance,
Brad
some values and produce a report based on a SQL query.
I have a self posting dropdown form which allows users to select the type of
report to generate:
Select the type of report to display:
<form runat="server">
<aspropDownList AutoPostBack="true" ID="report" runat="server">
<asp:listitem>Report Type 1</asp:listitem>
<asp:listitem>Report Type 2</asp:listitem>
<asp:listitem>Report Type 3</asp:listitem>
<asp:listitem>Report Type 4</asp:listitem>
<asp:listitem>Report Type 5</asp:listitem>
<asp:listitem>Report Type 6</asp:listitem>
</aspropDownList>
</form>
I am trying to write some conditional logic which determines which SQL query
will be run:
<script language="c#" runat="server">
public void Page_Load(object sender, EventArgs e) {
if (report.SelectedItem.Text == null) OR (report.SelectedItem.Text ==
"Report Type 1") {
string sql_query = "SQL QUERY";
}
// RUN THE QUERY
}
</script>
Unfortunately I keep getting the following error: Compiler Error Message:
CS1002: ; expected on the following line:
if (report.SelectedItem.Text == null) OR (report.SelectedItem.Text ==
"Report Type 1") {
I am sure this is a problem with my syntax but I'm just having problems
determining the correct syntax to use. Could anyone offer any pointers or
references to documentation?
Thanks in Advance,
Brad