Hi,
When I call my function below I get the error message at runtime
'Incorrect syntax near 'OUTPUT'
and cmb.ExecuteNonQuery() is highlighted...
Please can anyone see where the issue is..
Thanks
When I call my function below I get the error message at runtime
'Incorrect syntax near 'OUTPUT'
and cmb.ExecuteNonQuery() is highlighted...
Please can anyone see where the issue is..
Thanks
Code:
query = "UPDATE dbo.tblCustomer SET Title=@Title, FirstName=@FirstName, LastName=@LastName, Address1=@Address1, Address2=@Address2, Address3=@Address3, Town=@Town, PostCode=@PostCode, Country=@Country, TelephoneNo=@TelephoneNo, MobileNo=@MobileNo, FaxNo=@FaxNo, Email=@Email, OrganisationID=@OrganisationID, CitrixUsername=@CitrixUsername, DateSetup=@DateSetup, DateSetupConfirmed=@DateSetupConfirmed, DateSent=@DateSent, DateReceiptConfirmed= @DateReceiptConfirmed, DisabledDate= @DisabledDate, TrainingLocation=@TrainingLocation, TrainingDate=@TrainingDate, KeyfobFlag=@KeyfobFlag, KeyfobID=@KeyfobID, PIN=@PIN, DatePinIssued=@DatePinIssued, ActiveFlag=@ActiveFlag, Notes@Notes OUTPUT DELETED.Title,DELETED.FirstName,DELETED.LastName,DELETED.Address1,DELETED.Address2,DELETED.Address3,DELETED.Town,DELETED.PostCode,DELETED.Country,DELETED.TelephoneNo,DELETED.MobileNo,DELETED.FaxNo,DELETED.Email,DELETED.OrganisationID,DELETED.CitrixUsername,DELETED.DateSetup,DELETED.DateSetupConfirmed,DELETED.DateSent,DELETED.DateReceiptConfirmed,DELETED.DisabledDate,DELETED.TrainingLocation,DELETED.TrainingDate,DELETED.KeyfobFlag,DELETED.KeyfobID,DELETED.PIN,DELETED.DatePinIssued,DELETED.ActiveFlag,DELETED.Notes INTO tblCustomerHistory WHERE UserID = @UserID"
cmd = New SqlCommand(query, conn)
cmd.Parameters.AddWithValue("@Title", IIf(cmbtitle.Text.Length > 0, cmbtitle.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@FirstName", IIf(txtfirstname.Text.Length > 0, txtfirstname.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@LastName", IIf(txtlastname.Text.Length > 0, txtlastname.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@Address1", IIf(txtAdd1.Text.Length > 0, txtAdd1.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@Address2", IIf(txtAdd2.Text.Length > 0, txtAdd2.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@Address3", IIf(txtAdd3.Text.Length > 0, txtAdd3.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@Town", IIf(txtTown.Text.Length > 0, txtTown.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@PostCode", IIf(txtPostCode.Text.Length > 0, txtPostCode.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@Country", IIf(cmbcountry.Text.Length > 0, cmbcountry.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@TelephoneNo", IIf(txtWorkNo.Text.Length > 0, txtWorkNo.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@MobileNo", IIf(txtMobileNo.Text.Length > 0, txtMobileNo.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@FaxNo", IIf(txtFaxNo.Text.Length > 0, txtFaxNo.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@Email", IIf(txtEmail.Text.Length > 0, txtEmail.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@OrganisationID", IIf(cmbOrgName.ValueMember.Length > 0, cmbOrgName.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@CitrixUsername", IIf(txtusername.Text.Length > 0, txtusername.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@DateSetup", IIf(txtdatesetup.Text = String.Empty, DBNull.Value, txtdatesetup.Text))
cmd.Parameters.AddWithValue("@DateSetupConfirmed", IIf(txtdatesetupconf.Text = String.Empty, DBNull.Value, txtdatesetupconf.Text))
cmd.Parameters.AddWithValue("@DateSent", IIf(txtdatesent.Text = String.Empty, DBNull.Value, txtdatesent.Text))
cmd.Parameters.AddWithValue("@DateReceiptConfirmed", IIf(txtdaterecptconf.Text = String.Empty, DBNull.Value, txtdaterecptconf.Text))
cmd.Parameters.AddWithValue("@DisabledDate", IIf(txtdisabledate.Text = String.Empty, DBNull.Value, txtdisabledate.Text))
cmd.Parameters.AddWithValue("@TrainingLocation", IIf(cmbtrainloc.Text.Length > 0, cmbtrainloc.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@TrainingDate ", IIf(txttraindate.Text = String.Empty, DBNull.Value, txttraindate.Text))
cmd.Parameters.AddWithValue("@KeyfobFlag", IIf(cmbkeyflg.Text.Length > 0, cmbkeyflg.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@KeyfobID", IIf(cmbkeyfobno.ValueMember.Length > 0, cmbkeyfobno.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@PIN", IIf(txtpin.Text.Length > 0, txtpin.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@DatePinIssued", IIf(txtdatepinissued.Text = String.Empty, DBNull.Value, txtdatepinissued.Text))
cmd.Parameters.AddWithValue("@ActiveFlag", IIf(chkflg.Text.Length > 0, chkflg.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@Notes", IIf(txtnotes.Text.Length > 0, txtnotes.Text, DBNull.Value))
cmd.Parameters.AddWithValue("@UserID", txtuserid.Text)
cmd.ExecuteNonQuery()