freakonaleashlp
04-08-2009, 03:58 AM
Hi,
I am trying to insert data into the 'orderdata' table using an SqlDataSource's InsertCommand. However, when I checked the Insert Query Generator on the control panel of MLA, I found that the generated query contains an "N" character before every text entry. What is the significance of this?
Also, when the InsertCommand is set to string values, like so:
USE [SQL2005_576508_k2sd] INSERT INTO [dbo].[orderdata] ([Name], [Address], [State], [ZipCode], [Country], [Email], [PhoneNo], [CellPhoneMake], [CellPhoneModel], [CellPhoneOSRev], [CarMake], [CarModel], [CarYear], [CarMake2], [CarModel2], [CarYear2], [Service], [Type]) VALUES (N'Yohan ', N'Blah ', N'UT', 84102, N'USA ', N'rsfsc ', 9898, N'Apple ', N'iPhone ', N'3.2 ', N'Audi ', N'A4 ', 2009, N'Audi ', N'S4 ', 2009, 1, 2
it works, but if it is set to form parameters defined in the code, like so:
USE [SQL2005_576508_k2sd] INSERT INTO [dbo].[orderdata] ([Name], [Address], [State], [ZipCode], [Country], [Email], [PhoneNo], [CellPhoneMake], [CellPhoneModel], [CellPhoneOSRev], [CarMake], [CarModel], [CarYear], [CarMake2], [CarModel2], [CarYear2], [Service], [Type]) VALUES (N @Name, N @Address, N @State, @ZipCode, N @Country, N @Email, @PhoneNo, N @CellPhoneMake, N @CellPhoneModel, N @CellPhoneOSRev, N @CarMake, N @CarModel, @CarYear, N @CarMake2, N @CarModel2, @CarYear2, @Service, @Type)
it does not work, with or without the "N", with or without a space between the "N" and the @variable.
Please help!
Thanks,
Rohan
I am trying to insert data into the 'orderdata' table using an SqlDataSource's InsertCommand. However, when I checked the Insert Query Generator on the control panel of MLA, I found that the generated query contains an "N" character before every text entry. What is the significance of this?
Also, when the InsertCommand is set to string values, like so:
USE [SQL2005_576508_k2sd] INSERT INTO [dbo].[orderdata] ([Name], [Address], [State], [ZipCode], [Country], [Email], [PhoneNo], [CellPhoneMake], [CellPhoneModel], [CellPhoneOSRev], [CarMake], [CarModel], [CarYear], [CarMake2], [CarModel2], [CarYear2], [Service], [Type]) VALUES (N'Yohan ', N'Blah ', N'UT', 84102, N'USA ', N'rsfsc ', 9898, N'Apple ', N'iPhone ', N'3.2 ', N'Audi ', N'A4 ', 2009, N'Audi ', N'S4 ', 2009, 1, 2
it works, but if it is set to form parameters defined in the code, like so:
USE [SQL2005_576508_k2sd] INSERT INTO [dbo].[orderdata] ([Name], [Address], [State], [ZipCode], [Country], [Email], [PhoneNo], [CellPhoneMake], [CellPhoneModel], [CellPhoneOSRev], [CarMake], [CarModel], [CarYear], [CarMake2], [CarModel2], [CarYear2], [Service], [Type]) VALUES (N @Name, N @Address, N @State, @ZipCode, N @Country, N @Email, @PhoneNo, N @CellPhoneMake, N @CellPhoneModel, N @CellPhoneOSRev, N @CarMake, N @CarModel, @CarYear, N @CarMake2, N @CarModel2, @CarYear2, @Service, @Type)
it does not work, with or without the "N", with or without a space between the "N" and the @variable.
Please help!
Thanks,
Rohan