I Have Created an application with sql database?
but it'll give me an error saying
"
The parameterized query '(@Uname nvarchar(5),@Cus_Name nvarchar(5),@Cus_Cntat bigint,@Sub' expects the parameter '@TktType', which was not supplied.
"
my database is like this
Id = int(automatically generated) not allow nulls
Uname = Varchar(max)
Cust_Name = Varchar(max)
Cust_Cntact = Varchar(max)
Submit_Date = date
Req_Date = date
More_Details = Varchar(max)
Ticket_Type = Varchar(max)
Pax_No = int
First_Stat = Varchar(max)
Sec_Stat = Varchar(max)
Third_Stat = Varchar(max)
all other allows null other than id.
and i set the data format as well........
using (SqlCommand command = new SqlCommand("INSERT INTO Enquiry (Uname,Cust_Name,Cust_Cntact,Submit_Date,Req_Date,More_Details,Ticket_Type,Pax_No,First_Stat,Sec_Status,Third_Status) VALUES (@Uname,@Cust_Name,@Cust_Cntact, @Submit_Date, @Req_Date, @More_Details, @Ticket_Type, @Pax_No, @First_Stat, @Sec_Status, @Third_Status)", con))
{
command.Parameters.AddWithValue("@Uname", ClassEnq.Uname);
command.Parameters.AddWithValue("@Cust_Name", Cus_Name1);
command.Parameters.AddWithValue("@Cust_Cntact", Convert.ToInt64(Cus_Contact.Text));
command.Parameters.AddWithValue("@Submit_Date", Submit.Value.Date);
command.Parameters.AddWithValue("@Req_Date", Required.Value.Date);
command.Parameters.AddWithValue("@More_Details", More_Info.Text);
command.Parameters.AddWithValue("@Ticket_Type", Tkt_Type.SelectedValue);
command.Parameters.AddWithValue("@Pax_No", Convert.ToInt32(Pax_Count.SelectedValue));
command.Parameters.AddWithValue("@First_Stat", Stat_One.SelectedValue);
command.Parameters.AddWithValue("@Sec_Status", StatTwo.Text);
command.Parameters.AddWithValue("@Third_Status", Stat_Three.Text);
command.ExecuteNonQuery();
con.Close();
MessageBox.Show("Record inserted. Please check your table data. :)");
}
i think there is no issue with parameters because all are matched.