I'm attempting to do an insert on a view in my database and the resulting sql that llbl generates is incorrect and is causing a sql exception. Below is my test code and the error that i'm getting.
//creating a new quickadd entity
EmployeeQuickAddEntity employee = new EmployeeQuickAddEntity();
//set the values the user entered;
employee.Ssn = _sSN;
employee.LastName = _lastName;
employee.FirstName = _firstName;
employee.Initial = _initial;
employee.Active = _active;
employee.BranchName = _branchName;
employee.PhoneNumber = _phoneNumber;
employee.Address = _address;
employee.Address2 = _address2;
employee.City = _city;
employee.Zip = _zip;
employee.State = _state;
employee.MaritalStatus = _maritalStatus;
employee.StateExemptions = Convert.ToByte(_stateExemptions);
employee.FederalExemptions = Convert.ToByte(_federalExemptions);
employee.TaxModel = _taxModel;
employee.CountyJuris = _countyJuris;
employee.CityJuris = _cityJuris;
employee.SchoolJuris = _schoolJuris;
employee.County = _county;
employee.SchoolDistrictCode = _schoolDistrictCode;
employee.SchoolTaxExempt = _schoolTaxExempt;
employee.CityTaxExempt = _cityTaxExempt;
employee.CountyTaxExempt = _countyTaxExempt;
//get adapter ready
DataAccessAdapter adapter = new DataAccessAdapter();
//save the entity ---this is where it throws the error
adapter.SaveEntity(employee,true);
_aIdent = employee.Aident;
and the sql code that is getting sent to the sql server
declare @p3 int
set @p3=NULL
exec sp_executesql N'INSERT INTO [tworks].[dbo].[Employee] ([SSN], [LastName], [FirstName], [Initial], [Active], [BranchName], [PhoneNumber],
[Address], [Address2], [City], [Zip], [State], [MaritalStatus], [StateExemptions], [FederalExemptions], [TaxModel], [CountyJuris],
[CityJuris], [SchoolJuris], [County], [SchoolDistrictCode], [SchoolTaxExempt], [CityTaxExempt], [CountyTaxExempt]) VALUES (@Ssn, @LastName,
@FirstName, @Initial, @Active, @BranchName, @PhoneNumber, @Address, @Address2, @City, @Zip, @State, @MaritalStatus, @StateExemptions,
@FederalExemptions, @TaxModel, @CountyJuris, @CityJuris, @SchoolJuris, @County, @SchoolDistrictCode, @SchoolTaxExempt, @CityTaxExempt,
@CountyTaxExempt);SELECT @Aident=',N'@Aident int output,@Ssn int,@LastName varchar(50),@FirstName varchar(50),@Initial varchar(10),@Active
bit,@BranchName varchar(25),@PhoneNumber varchar(255),@Address varchar(50),@Address2 varchar(50),@City varchar(50),@Zip varchar(10),@State
varchar(5),@MaritalStatus char(1),@StateExemptions tinyint,@FederalExemptions tinyint,@TaxModel varchar(10),@CountyJuris
varchar(10),@CityJuris varchar(10),@SchoolJuris varchar(10),@County varchar(30),@SchoolDistrictCode int,@SchoolTaxExempt bit,@CityTaxExempt
bit,@CountyTaxExempt bit',@Aident=@p3
output,@Ssn=0,@LastName='testlastname',@FirstName='testfirstname',@Initial='',@Active=1,@BranchName='Memphis
SE',@PhoneNumber='555.555.5555',@Address='test streeet 1',@Address2='',@City='test
city',@Zip='',@State='',@MaritalStatus='S',@StateExemptions=0,@FederalExemptions=0,@TaxModel='EIC',@CountyJuris='', @CityJuris='',@SchoolJuris='',@County='',@SchoolDistrictCode=0,@SchoolTaxExempt=0,@CityTaxExempt=0, @CountyTaxExempt=0
select @p3
and the error from the sql server
Incorrect syntax near '='.
please let me know if I need to provide more details.