I'm new to this forum, and apologies if this is posted in the wrong place. I'm having some problems with some coding in the above languages. I have one particular problem, which I hope someone can help with.
I am trying to populate a field on a web form, based on the selections made in two drop down boxes (Combination of the two). On selecting the drop down values, it performs a lookup in the database to pull back a value, and populates a text field with this value.
I've got the SQL stored procedure covered, and the ASP.NET part of things. What I'm struggling on is the C# part. I have the following code so far:
However I get the following error on my page:
private void GetPriority()
clsServerDetails objServerDetails = new clsServerDetails();
SqlConnection objSql = new SqlConnection();
SqlCommand objCmd = new SqlCommand();
SqlDataAdapter objDa = new SqlDataAdapter();
objSql.ConnectionString = objServerDetails.ConnectionString;
objCmd.CommandText = "CPortalGetPriority";
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.Add("@Impact", SqlDbType.NVarChar, 100).Value = ddImpact.Text;
objCmd.Parameters.Add("@Severity", SqlDbType.NVarChar, 100).Value = ddUrgency.Text;
// objCmd.Connection = objSQL;
objDa.SelectCommand = objCmd;
catch (SqlException exSQL)
clsLogError.LogError("SqlException", exSQL.Number.ToString() + " " + exSQL.Message, System.Reflection.MethodBase.GetCurrentMethod().Name);
I'm assuming I can't just fill the text field with the output of the stored procedure, so what's the best way about going about this?
CS1502: The best overloaded method match for 'System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable)' has some invalid arguments
Line 135: objDa.SelectCommand = objCmd;
Line 137: objDa.Fill(txtPriority);
Line 138: }
Line 139: catch (SqlException exSQL)
Thanks in anticipation of your replies.