sql datasource insert error

hii,,i am using asp.net 2005 and sql server 2005...

i m using sql data source in my form,,i want to insert the details into a table using the insert command thr sqldatasource....one of the column name is service_w/lb, this is where i get an error.i am not able to insert the new data..here is my code::::

______________________________________

<asp:SqlDataSource ID="SqlDataSource1" runat="server"

ConnectionString="<%$ ConnectionStrings:sm123_trackerConnectionString %>"

SelectCommand="SELECT * FROM [Agency_Master]"

InsertCommand="INSERT INTO [Agency_Master] ([Agency_Id], [Agency_Main_Contact], [Agency_Invoice_Contact], [Address], [Email_Address], [Phone], [Mobile], [Fax], [TimeZone_Id], [Agency_Name], [Service_w/LB], [Notes], [Technology_Used], [Status with LB]) VALUES (@Agency_Id, @Agency_Main_Contact, @Agency_Invoice_Contact, @Address, @Email_Address, @Phone, @Mobile, @Fax, @TimeZone_Id, @Agency_Name, @Service_w/LB, @Notes, @Technology_Used, @Status_with_LB)"

OldValuesParameterFormatString="original_{0}"

>

_____________________________________

even if i put it as @[service_w/Lb] i get an error....here is the error i get

__________________________________________

Incorrect syntax near 'nvarchar'.
The name "Service_w" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.____________________

pls reply as soon as possible ,,,thnks in advance

0
johnny
2/28/2008 1:09:59 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

2 Replies
756 Views

Similar Articles

[PageSpeed] 13

It seems prettty obvious that something is complaining about the forward slash "/" in either your column name or associated parameter name. I'd remove one at a time and see what works.


Thanks, Ed

Microsoft MVP - ASP/ASP.NET

0
ecbruck
2/28/2008 1:17:18 PM

ohhhh yes,,,thnks dear,,should have done tht 1st only......

thnks its solvdSmile

0
johnny
2/28/2008 1:37:08 PM
Reply:

Similar Artilces:

Converting a gridView using an Sql Datasource to a gridview who is not using an SQL DataSource
How can i rewrite this page so that i doesnt make use of an SqlDataSource?  <%@ Control Language="C#" AutoEventWireup="true" CodeFile="LoginHistory.ascx.cs" Inherits="Private_UserControls_WebUserControl" %> <html> <head> <%--<link rel="stylesheet" href="BaldwinPortal.css" mce_href="BaldwinPortal.css" type="text/css" />--%> <title>Login History</title> </head> <body style="margin:0 0 0 0;padding:0 0 0 0"> ...

Compiled sql CommandText going from DataSource to sql server
HiI need to know what command text goes to sql server in a compiled (parameterless) formatEx :I have a sql query : "Select  * from table where name=@name"name parameter has value = "bill gates"When I read the e.command.commandtext value in sqldatasource.inserting event, it gives the original command (with parameter @name)In datasource.inserting event, how can I get the compiled version of the command  : "Select * from table where name='bill gates'"please help me Why do you need to get the value?  What do you plan to do with it?Brian"Trust in the Lord and do what is good...

Migrating VS2003 datasource from SQL 2000 to SQL 2005
Is it necessary to convert my VS2003 project to VS2005 before converting the datasource from SQL 2000 to SQL 2005? Or can I just change the datasource without converting the project? Hi delossan, For the first question, the answer is no. Both SQL Server versions can work with Visual Studio 2003 and Visual Studio 2005. For the second question, the answer is yes. Visual Studio 2003 can work with SQL Server 2005.    Sincerely,Benson YuMicrosoft Online Community Support Please remember to mark the replies as answers if they help and unmark them if they provide no help. This can ...

SQL Datasource
HiI am ASP.NET developer.I want to use sql datasource in my application.Since my application is a 3 Tier application, so how can I use sql data source in  my application to populate grid view because I have to apply soring in the grid view. And also it must be safe in terms of security. ThanksAbdul Javed Khan If you're using 3-tier application, you should use ObjectDataSource instead of SqlDataSource. And to get auto sorting and paging in GridView, return data to ObjectDataSource in a DataTable or DataView. HiCould you please give me some sort of code regarding these.Thank...

SQL DataSource
I working on a form using an SQL DataSource. I am going to add a where clause. In that where clause a value from a label will be passed from the user. How do I pass to the HTML Source the label value from the where clause. The value can change from user to user. Sample below: SELECT [KeyRolesID], [KeyRolesDesc] FROM [KeyRoles] WHERE ([JobCodeFamily] = @JobCodeFamily). I want to replace the @JobCodeFamily which is currently coded with a value from the Sql DataSource in the design form with a label value entered by the user. I'm not sure what you mean by a "label value", but you will li...

SQL DataSource updates all but one field (and no error!)
This is a very wierd problem. I have a DetailsView populated by a select from a single table in a SQL 2000 database. The purpose of the DetailsView, of course, is to display existing data, edit existing data, or add a new record. All works well except Update. The update will save the row back to the database with new data in any or all field except one, not counting the key field, of course. I have changed the SQLDataSource from SQL statements for Select, Update, Insert, etc. to Stored Procedures and back again with no change in behavior. I can run the exact same Update statement in Query A...

Insert SQL on Sql Command
i'm using an sql command for insert query it looks like this cmd=new sqlcommand("insert into tblname values('" & textbox1.text & "')",cn) cmd.executereader the problem is if i type a singlequote or double quote an error is throwing,invalid syntax .... how can i s'rt out it with out using a sql stored procedure thanks in advance PrasantHI think therefore i'mvPras© Hi, try replacing the single quotes present in your input with double single quotes ... example below: string sqlInput = textbox1.text.Replace("'","''...

Turning off impersonation on a SQL Server datasource, connecting to datasource using Reporting Services credentials
Dear SQL Server Reporting Services Support Guru, How do we configure Reporting Services such that when it attempts to connect to a datasource (e.g. Microsoft SQL Server datasource), it connects as the service account under which it is running as opposed to the calling user? From our research we were thinking we could try one of two things:  1) change the credential type on the datasource itself so that it does not use Windows Integrated Security and instead connects as itself or 2) change the <identity impersonate="true"> flag in the web.config of the ReportServe...

Error Sorting a GridView with a SQL Stored Procedure DataSource
I have a page with a gridview that gets data from a sql stored procedure.  The gridview renders the data correctly on page load.  When a column header is clicked, the sorting event fires, gets the sort expression and sort order, passes that to the populategridview() sub, and the stored procedure re-runs - sorting in the requested order.  However when the data binds to the gridview after sorting, the sorting event is fired AGAIN, caused the sort order to be wrong.  See sample code:Private Sub PopulateViewTestsGridView(Optional ByVal SortExpression As String = "Su...

Error occuring wen trying to write to xml file from sql datasource
Hi all I am having a spot of difficulty with the following code, it gives me a InvalidOperation unhandled by user code error: Imports System.Data.Sql Imports System.Data.SqlClient Imports System.Xml.XmlWriter Imports System.XmlPartial Public Class RSStest Inherits System.Web.UI.PageProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim cn As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ToString)Dim cm As New SqlCommand ' set the conenction and query string cm.Connection = cn c...

how do i insert data into sql server using data from textboxes and sql connection and sql command
anyone can give me a simple explaination and code.. Thanx in advance Take a look @ Sample Code: How to add...Sushila Bowalekar PatelVisual ASP/ASP.NET MVPhttp://weblogs.asp.net/sushilasb There are a lot of tutorials out there, but I know they can be a bit confusing as they all approach things slightly differently. Basically a nice simple version would go like this:' *** First set up your connectionDim conConnection As New SqlConnection("server=servername;database=yourdatabase;uid=yourname;pwd=yourpassword;")' *** This line takes care of your sommand text and command connection in one ...

MS SQL Server 7.0 error when trying to insert or delete a record in sybase base from SQL 7.0 analyser
Hello do you do know why when i try to delete an existing sybase server record or insert or call a stocked procedure i get an error message : (with client sybase 12) SQL analyzer code for delete : "delete from DS_CATS_INT.cats_int.dbo.TmpProduct where productId='riri'" i get this error message : Server: Msg 7399, Level 16, State 1, Line 1 OLE DB provider 'MSDASQL' reported an error. [OLE/DB provider returned message: Unspecified error] [OLE/DB provider returned message: You can't have multiple recordsets with this cursor type (in a transaction.)...

MS SQL Server 7.0 error when trying to insert or delete a record in sybase base from SQL 7.0 analyser
Hello do you do know why when i try to delete an existing sybase server record or insert or call a stocked procedure i get an error message : (with client sybase 12) SQL analyzer code for delete : "delete from DS_CATS_INT.cats_int.dbo.TmpProduct where productId='riri'" i get this error message : Server: Msg 7399, Level 16, State 1, Line 1 OLE DB provider 'MSDASQL' reported an error. [OLE/DB provider returned message: Unspecified error] [OLE/DB provider returned message: You can't have multiple recordsets with this cursor type (in a transaction.)...

Help with modifying datasource sql and working correctly with Editing, Inserting, and Deleting in a gridview
I have a dropdown that displays departmental options (All, Parts, Service, New Truck, etc.)  The actual values for these are abbreviations (All=All, Parts=P, Service=SVC, New Truck=NT, etc.) and all build the dropdown except for the "-- Choose a Dept --" option, which I manually added to the dropdown. The datasource is bound to the dropdown control and the dropdown auto postback is on.  When the page loads, no data is returned b/c the "--Choos a Dept--" option is selected.  Below is a sample of data and how it sits in the table: tblObjectives ...

Web resources about - sql datasource insert error - asp.net.sql-datasource

Datasource - Wikipedia, the free encyclopedia
A DataSource object has properties that can be modified when necessary. For example, if the data source is moved to a different server, the property ...

Inverness Graham Acquires DataSource
Inverness Graham , a lower middle market private equity firm headquartered in suburban Philadelphia, has acquired DataSource , a print supply ...

SmartGlance for iPad for iPad on the iTunes App Store
Read reviews, get customer ratings, see screenshots, and learn more about SmartGlance for iPad on the App Store. Download SmartGlance for iPad ...

Chaitanya Pandit (@chaitanyapandit) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Data source - Wikipedia, the free encyclopedia
... Data source A data source is any of the following types of sources for (mostly) digitized data: a database in the Java software platform, datasource ...

2ndQuadrant - PostgreSQL expertise from specialists with a source code level understanding of RDBMS ...
PostgreSQL expertise from specialists with a source code level understanding of RDBMS PostgreSQL Planets Gabriele’s PlanetPostgreSQL Gianni’s ...

Tagged entries for CLOUD COMPUTING
Alan Williamson's output as a Java Champion, Blog-City Architect, BlueDragon Creator, Author, Speaker and Internet Guru

Private equity deals
... of biometric identity management systems, applications and services. www.crossmatch.com Inverness Graham Investment has acquired DataSource ...

C# C Sharp and Tutorials on C# Friends.com
Learn the c# langauge to build web applications using our online tutorials with live demos. Participate in our forums and learn from others. ...

JavaScript UI Library, Ajax Components & HTML5 Framework - DHTMLX
DHTMLX offers a rich JavaScript library, UI components & HTML5 mobile framework. Build impressive web apps for both desktop and mobile devices. ...

Resources last updated: 1/18/2016 6:54:04 PM