code:
1
2
3
4
5
6
7
8
9
10
11
12
| SqlCommand zoekhuis = new SqlCommand("sp_zoek_alternatief", connection);
zoekhuis.CommandType = CommandType.StoredProcedure;
zoekhuis.CommandText = "sp_zoek_alternatief";
zoekhuis.Parameters.Add("@begindatum", SqlDbType.DateTime).Value = Application["periodevan"];
zoekhuis.Parameters.Add("@einddatum", SqlDbType.DateTime).Value = Application["periodetot"];
zoekhuis.Parameters.Add("@huisid", SqlDbType.Int).Value = Application["alternatievenid"];
connection.Open();
SqlDataAdapter adapter = new SqlDataAdapter(zoekhuis);
DataSet result = new DataSet();
adapter.Fill(result); |
Dit bovenstaande is mijn code waarop ik de volgende error krijg:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
| ExecuteReader: CommandText property has not been initialized 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. Exception Details: System.InvalidOperationException: ExecuteReader: CommandText property has not been initialized Source Error: Line 34: Line 35: DataSet dataset = new DataSet(); Line 36: adapter.Fill(dataset); Line 37: command.ExecuteReader(System.Data.CommandBehavior.CloseConnection); Line 38: return dataset; |
Ik begrijp niet wat ik fout doe, Ik zet toch gewoon de commandtext property?
Misschien domme vraag , maar ik ben nog niet zo lang bezig met ASP.NET en kon het verder nergens vinden
Please help..