OracleDataAdapter da = new OracleDataAdapter(sel, con);
DataSet dscity = new DataSet();
da.Fill(dscity, "STATE_CITY_DISTCD_VW");
return dscity;
con.Close();
con.Dispose();
}
Server Error in '/hits' Application.
--------------------------------------------------------------------------------
ORA-00936: missing expression
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Line 104: OracleDataAdapter da = new OracleDataAdapter(sel, con);
Line 105: DataSet dscity = new DataSet();
Line 106: da.Fill(dscity, "STATE_CITY_DISTCD_VW");
Line 107: return dscity;
Line 108: con.Close();
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082
Look at the way you are building the query. You are actually building a dynamic query and then you are also adding parameters to it. This is not the right way to do it. Your query in the else part should look like this
Code:
sel = "SELECT DISTINCT STATE_COUNTRY_CODE, CITY FROM STATE_CITY_DISTCD_VW WHERE SOURCE_YEAR >= @FromYear and SOURCE_YEAR < @ToYear and Record_Type = @RecordType and STATE_COUNTRY_CODE = @MyState";
cmd.Parameters.AddWithValue("@FromYear", FromYear);
cmd.Parameters.AddWithValue("@ToYear", ToYear);
cmd.Parameters.AddWithValue("@RecordType", mytype);
cmd.Parameters.AddWithValue("@MyState", MyState);
Use [code]your code here[/code] tags when you post source code
Search here before you post your question, someone might have already asked it before. My Articles
Also I don't see anything wrong with the query that I posted above, maybe you are missig something in your code. Anyways, look at the example in the article that I posted a link to and you should be good to go.
Use [code]your code here[/code] tags when you post source code
Search here before you post your question, someone might have already asked it before. My Articles
We do not help here on PMs. if you have a question, you can post it here on the forums. This way you increase the chances of getting a reply. If you use PMs, you will have to depend on one person only.
Also your PMs are disabled by default. You will have to enable them to receive the messages. Look at your User CD(Control Panel).
Use [code]your code here[/code] tags when you post source code
Search here before you post your question, someone might have already asked it before. My Articles
Bookmarks