HI,
I have written a statement to update hits per record in DB (im using access db).
However, if i add where clause i get an error "Parameter ?_1 has no default value".
This is my code:
thanks,
I have written a statement to update hits per record in DB (im using access db).
However, if i add where clause i get an error "Parameter ?_1 has no default value".
This is my code:
Code:
protected void DataList1_Load(object sender, EventArgs e)
{
Label Label1 = DetailsView1.FindControl("Label1") as Label;
Label hits = DataList1.FindControl("hits") as Label;
TextBox TextBoxVideoId = DataList1.FindControl("TextBoxVideoId") as TextBox;
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\CenterDB.mdb";
OleDbConnection conn = new OleDbConnection(connectionString);
conn.Open();
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = conn;
cmd.CommandText = "UPDATE VIDEO_MOJI SET hits = hits + 1 WHERE VideoId = ?";
cmd.Parameters.Add("@hits", OleDbType.Integer).Value = hits;
cmd.ExecuteNonQuery();
conn.Close();
}
thanks,