.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Post New Web Links

Incorrect Sytax ????

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :ASP.Net

Can someone give me a fresh set of eyes and tell me what they see wrong?? I am getting error ... "Incorrect syntax near "Where" "

Dim Query As String = Request.QueryString("WhichImage").ToString

datasource.UpdateCommand = "Update ImageName SET" & " " & Query & " " & "Where" & " " & Query & "=" & Query & " " & "ImageName=ImageName" & ";"

View Complete Post

More Related Resource Links

override error message (The value 'test' is not valid for Age) when input incorrect data type for in


Hello everyone,

I've tried to override error message when input incorrect data type in input field on HTML form. For example I have the model like this.

public class Person
public string FirstName {get;set;}
public int Age {get;set;}


For view, I put text input for Age to get it value.

When type some string in Age text box like 'test' and press submit button. I got this error message

The value 'xxx' is not valid for Age

However, I want to change this message and try many way. There 's nothing effect this message value.

Please could you help me to solve this problem.

Menu items of Welcome control behaves incorrect in non-IE browsers.


We are using wss 3.0 sp2

I am referring to the welcome control that is part of standard sharepoint pages. This is the in the masterpage. The welcome contrrol has options such as 'sign-in as different user' , 'signout' and so on. When user takes the mouse and tries to click on the sub-menu it doesn't work as if the menu item is not getting focussed (however up/down arrow with keyboard works fine). 

I know that sharepoint sites are not best when viewed with firefox, safari, chrome etc  but is there a fix for this? Is it do with 'z' index setting or something? Can this be fixed through javascript?  

Please share your views/solution.


Incorrect syntax near 'GO' error while running a sql script ?


I am using Visual Studio 2008

I have one Database A

now i want to create Database B just like Database A

I generated a script of Database A

and created fresh Database B

Now, when i try to run the generated script against Database B, i get this error, why ? how to fix it ?

sql error

For your information:

I have checked in my script it is:


and i have also tried to save the sql script in notepad as: ANSI, UTF-8 and UNICODE

and then i copied from txt file to query but still doesn't work and getting the same error

and these are the option that i selected/used while creating my script:


Incorrect syntax near "("


Hi, below is a sub I wrote to run an SQLDataSource UpdateCommand. This is customized layer of a createUserWizard. I know I should probably have another table for the addt'l data and just FK the UserId...but I'd rather update the existing record and add the data to the existing row in the user (membership) table.

Can someone tell me what I'm doing wrong on this sub. The error is at the last line, "DataSource.Update()"


 Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As EventArgs)
        FormsAuthentication.SetAuthCookie(CreateUserWizard1.UserName, False)

        Dim UserNameTextBox As TextBox = DirectCast(CreateUserWizardStep2.ContentTemplateContainer.FindControl("UserName"), TextBox)
        Dim DataSource As SqlDataSource = DirectCast(CreateUserWizardStep2.ContentTemplateContainer.FindControl("InsertExtraInfo"), SqlDataSource)

        Dim User As MembershipUser = Membership.GetUser(UserNameTextBox.Text)
        Dim UserGUID As Object = User.ProviderUserKey

        DataSource.UpdateParameters.Add("UserId", UserGUID.ToString())

End Sub



Incorrect syntax near '<'

It was suggested that I use xmldocument.load to do a sql insert statement instead of BULK INSERT.  However when I run the Sub I am getting this error:  "Incorrect syntax near '<'.   "Here is my code, I have no clue what is causing this error, or how to fix it. Sub AO() Dim Z As String = Microsoft.VisualBasic.Format(Today.AddDays(-1), "MMddyyyy") Dim AO_Name As New String("\\Net\Import\AO-M_" & (Z) & ".xml") Console.WriteLine(AO_Name) Dim AOSQL As String Dim conn As New SqlConnection("Server=DEB\DEVDB;Database=MTrans;User Id=******;Password=**************************;") Dim cmd As New SqlCommand Dim x as New XMLDocument x.Load(AO_Namme) Dim xx As String xx=x.OuterXml AOSQL = "DECLARE @xml XML" + Environment.NewLine() + _ "SELECT @xml = " + xx + _ "Insert into AO (ASSET_OWNER_NAME,SCHEDULED_DATE,SETTLEMENT_CODE, INVOICE, OPERATING_DATE, DA_ADMIN, DA_ASM_REG, DA_ASM_SPIN)" + Environment.NewLine() + _ "SELECT ASSET_OWNER_NAME,SCHEDULED_DATE,CAST(SETTLEMENT_CODE AS smallint) AS SETTLEMENT_CODE, INVOICE, OPERATING_DATE, DA_ADMIN, DA_ASM_REG, DA_ASM_SPIN" + Environment.NewLine() + _ "FROM " + Environment.NewLine() + _ "(SELECT " + Environment.NewLine() + _ "summary.x.value('NAME[1]', 'VARCHAR(10)') AS ASSET_OWNER_NAME,summary.x.value('SCHEDULED_DAT

Data Source View Gives incorrect Error--Different Data Type

Hi, I'm creating a report model (2008 R2).  I am trying to create a relationship between two tables.  One FKs to another--same name and type (tinyint) columns.  But the Data Source View editor doesn't allow this, giving the message "...source and destination column have different data types".  But the columns are the same types.  I ahd this once before  acouple of years ago and don't remember how I got around it. Does anyong have ideas?  

A call to SSPI failed: The target principal name is incorrect - How to ignore this Security Check

I find that I am getting this error since I am using the netTCPBinding. I don't get this exception when the client and server are on the same machine, but when they are on different machines, this exception occurs. If I set the identity on the end point as mentioned in the article: http://blogs.msdn.com/b/drnick/archive/2007/11/08/setting-a-user-principal-on-the-endpoint.aspx it is working fine.   So my question is , should the service end point always have an identity when using netTcpBinging? I tried setting Security.Mode = None and still I got this identity exception. is there any way through which I can ask the service to ignore the SSPI details and accept client request?   Thanks!

How to redirect incorrect login?

I have a Membership login.If the "login incorrect", the page is redirected to www.domain.com / LoginError.aspx,If the "login incorrect" the page is redirected to the previous web page history.back ()What do I do?Please Help.

Incorrect syntax near '>'.

Hello everyone,I am getting a strange error message; Incorrect syntax near '>'.I made a listview with some dropdownmenu and selectboxes to select from untill the query shows in the listview.Now the query goes well and shows the first page of 4 rows as I wanted it.The pager shows 5 pages and if I a want to click on the next page I get this message. Incorrect syntax near '>'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near '>'. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SqlException (0x80131904): Incorrect syntax near '>'.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2030802 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009584 System.Data.SqlC

Incorrect number of users reported in SharePoint Usage Logs

* See last post - issue appears related to KB 969231 *   It seems SharePoint 2007 usage logging with anonymous access worked in IIS6 but not IIS7. Is there a way to fix it?   Background: The SharePoint Usage logging was working fine (approximately 20,000 hits per day) until the upgrade to a new IIS7 environment. The configuration in both environments is very similar (both Anonymous Access and Windows Authentication are enabled) however the new environment is only showing 600 hits per day.   This forum response from Cornelius J. van Dyk [MVP] suggests that Usage analysis/logging with Anonymous Access doesn't work, however it does work in our old IIS6 environment (a dash "-" is just shown in the usage logs which suggests an anonymous user): http://www.eggheadcafe.com/software/aspnet/29823445/sharepoint-doubt-is-there-any-way-to-find-out-how-many-users-have-logged-in-to-the-sharepoint-site.aspx   So I've concluded it's differences in IIS6/IIS7 authentication. Reading articles on the differences (e.g.  single auth pipline instead of two-stage) doesn't highlight any obvious reasons why this wouldn't work.   Any help would be greatly appreciated.   Thanks,   Peter

Word Document date property defaulting to an incorrect value.

Within a SharePoint document library we have a custom column that is a date (Inactive date). If you look at the properties from within SharePoint on a document the date is empty. If you open the document in Word 2007 and look at the properties the date has acquired a value, always the same value 30/11/1999. If you save the document and look at the properties in SharePoint again it now has the value.  Unfortunately in Business terms this now shows that the document is “In Active”. I traced the date back to the template document on the library. I edited the template document by removing the date and saving it. If I then create a new document and save it again the properties in SharePoint show an empty date. However if I then open the document again in Word the date appears. This problem does not occur with word 2003. How can I stop the date defaulting to this value when a document is opened in Word?

Incorrect hostname in EndPoint location in WSDL for a service with multiple bindings and with multip

We have a WCF web service that is exposed through multiple bindings.  The site is  accessed through multiple IP Addresses/Hostnames (internet/intranet).  Some of the bindings use http transport while others use https transport. The web application is configured to use .NET 4.0 with multipleSiteBindingsEnabled="true" so that we shouldn't have problems with multiple ip addresses/hostnames. What we see is that when the WSDL is accessed using a http based URL (external), the hostnames in the endpoint addresses for http transport based bindings in WSDL are correct (ie, they use the hostname header from the request) while the hostnames in the endpoint addresses for https transport based bindings in the WSDL are incorrect (ie, they do not use the hostname header in the request - they seem to use the hostname from the first available binding in IIS for that scheme and end up with the local machine names/ip addresses in the URL).   We could work around by setting the external hostname/ip in the first binding in IIS for the respective scheme, but then WSDLs accessed from intranet clients would have wrong URLS now. This happens the other way around as well, ie, when the WSDL is accessed using https, the https based addresses are fine, but http addresses in the WSDL are not correct. It looks like hostname header is used only for WSDL endpoint addre

incorrect deserialization of webservice response

Hi,   I am trying to consume an axis2 webservice from a .NET CF platform. The development platform is Visual Studio 2008 . I have pasted the wsdl , sample response from webservice , for the getEpcByAttribute method.  On execution I initially got a Invalid Cast exception (details below):  System.InvalidCastException was unhandled   Message="InvalidCastException"   StackTrace:        at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length) On further investigation it seemed like the generated file (Reference.cs) had a two dimensional array, which the xmlserializer was trying to put the response into, and was failing. I tried to modify the generated file by converting the 2 dimensional array to a 1 dimensional array . The SOAP call was going through now, but the de-serialization was incorrect. Only the first row of the response was getting de-serialized. I have pasted relevant section from the Reference.cs below. Is there any workaround/fix for this problem (apart from modifying the webservice). Thanks.   WSDL: ---------- <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="urn:JDVisiblEdgeService" xmlns:axis2="urn:JDVisiblEdgeService" xmlns:ns1="http://vo.proj

.NET 4 LocBaml: An attempt was made to load a program with an incorrect format.

I am testing out LocBaml and a simple .NET 4 Wpf program with a button and a label only. I add the following to the PropertyGroup in the .csproj file <UICulture>en</UICulture> Now I open a Visual Studio command promt and build both LocBaml and my test project with msbuild. Then I copy locbaml.exe to the bin\debug of my test project. Then I add uid's to the testproject  by running "msbuild /t:update LocApp1.csproj". Now it is time to generate the csv file by using locbaml. I enter "locbaml /parse en\LocApp1.resources.dll" from the bin\debug folder and hit enter. I get the following error: Microsoft (R) Baml Localization Utility Copyright (C) Microsoft Corporation 2005. All rights reserved. Could not load file or assembly 'file:///D:\Projects\LocApp1Soln\LocApp1\bin\Debug\en\LocApp1.resources.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. What am I doing wrong here? The file is there and ildasm only show a dependency on mscorlib for the satellite assembly. Directory of D:\Projects\LocApp1Soln\LocApp1\bin\Debug\en 19.04.2010 22:08 4 608 LocApp1.resources.dll I am using VS2010 Professional on Windows 7 64bit.

SelectSingleNode returning incorrect text

I have the following XML<?xml version="1.0" encoding="utf-8" ?><procedures><procedure name="proc1"><text>hello world 1</text></procedure> <procedure name="proc2"> <text> hello world 2 </text> </procedure> </procedures>Now I am accessing this with the following codeXmlDocument xDoc=new XmlDocument();xDoc.Load(filepath);XmlNode proc=xDoc.SelectSingleNode("//procedure[@name='proc2']");xmlText=proc.SelectSingleNode("//text").InnerText;I was expecting xmlText to be "hello world 2" but it is actually "hello world 1" even though the innerXml of proc shows the correct xml. How is it selecting the previous text?

SharePoint 2010 email enabled list with workflow has incorrect User ID when items are emailed to the

I have set up an approval workflow for a document library that has email enabled. Emails come into the document library fine, however, if an item is emailed to the library the workflow kicks off with the initiator as "System Account" rather than the person who submitted the email. This makes the error of "The e-mail message cannot be sent. Make sure the e-mail has a valid recipient." come up. If someone submits a document directly to the library (by logging into sharepoint and submitting) everything works fine. The person submitting by email is a valid sharepoint user and the profile shows the correct email address. The Created by and Modified by fields show the correct person (rather than System Account), it's only the workflow User ID that shows incorrectly if document is emailed to library. Any help or ideas would be appreciated. Thanks

Spellchecker.suggestions language incorrect

Hi, I have a problem with the suggestions given by a SpellingError. It returns French suggestions (my computer uses French settings) even if I set the textBox's language to "en-us"...   // Creating textbox XmlLanguage XmlLanguage = XmlLanguage.GetLanguage("en-us"); TextBox textBox = new TextBox {UndoLimit = 0, Language = XmlLanguage}; textBox.SpellCheck.IsEnabled = true; // Later, in a method to get suggestions (to create a custom context menu)... SpellingError spellingError = textBox.GetSpellingError(offset); if (spellingError == null) return new List<string>(); return new List<string>(spellingError.Suggestions); Is there anything else I could try?   Thank you, Marie  
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend