|
Re: Insert command just doesn't work.
Hi,
Just had a closer look at the code and you are adding the parameters to the parameters collection of the command object before you add the value to each parameter
Maybe this block of code
parFirstName.Value = txtFirstName.Text
parLastName.Value = txtLastName.Text
parCompany.Value = txtCompany.Text
parAddress1.Value = txtAddress1.Text
parAddress2.Value = txtAddress2.Text
parCity.Value = txtCity.Text
parState.Value = txtState.Text
....
Should come before this..
cmd.Parameters.Add(parFirstName)
cmd.Parameters.Add(parLastName)
cmd.Parameters.Add(parCompany)
cmd.Parameters.Add(parAddress1)
cmd.Parameters.Add(parAddress2)
cmd.Parameters.Add(parCity)
Otherwise you are running your query with blank values. Consquently that is the reason no data is added to the database, because no data is being added to the command object.
Hope this helps.
|