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


Top 5 Contributors of the Month
Kaviya Balasubramanian
satyapriyanayak
SP
abhays
Sasi Prabhu
Post New Web Links

Problem with quotation mark that is not resolved using \"

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :ASP.Net
 

Hi everyone,

I have an aspx page that conatain:

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

ConnectionString="<%$ ConnectionStrings:myConnectionString %>

SelectCommand="SELECT t1.ID, t2.desc FROM table1 t1 JOIN \"10.10.10.10\".dbname.schemaName.table2 t2 ON t1.ID = t2.ID">


I can already see in visual studio that the quotation mark are not reacting as they should.

and when trying to run it I get: "The server tag is not well formed."

If I remove the \" from the string or try to replace " with '  I get incorrect syntax for the sql query.


How can i use place quotation mark in that string?





View Complete Post


More Related Resource Links

Unclosed Quotation Mark Error

  

 

Web Form (http://cforedu.com) post back reports: Unclosed quotation mark after the character string error

Message reads:


An Error Occurred: System.Data.SqlClient.SqlException: Unclosed quotation mark after the character string ''. Incorrect syntax near ''. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at _Default.Button1_Click(Object sender, EventArgs e) in http://server/Default.aspx.vb:line 17

 

Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
    Inherits System.Web.UI.Page

    Protected 

Unclosed Quotation Mark Error

  
Web Form post back reports: Unclosed quotation mark after the character string error Message reads: An Error Occurred: System.Data.SqlClient.SqlException: Unclosed quotation mark after the character string ''. Incorrect syntax near ''. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at _Default.Button1_Click(Object sender, EventArgs e) in http://server/Default.aspx.vb:line 17     Imports System.Data Imports System.Data.SqlClient Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim conn As SqlConnection = Nothing Try conn = New SqlConnection("Data So

Line 1: Incorrect syntax near ','. Unclosed quotation mark before the character ...

  

Can someone please review my code and see where I can be missing information. I get the following error:

Line 1: Incorrect syntax near ','. Unclosed quotation mark before the character string ' )'. at System.Data.SqlClient.SqlConnection.OnError(SqlExc eption exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQuer yTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNo nQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at _Default.SaveToDatabase(String SavePath) in C:\Inetpub\wwwroot\Webfile1\Default.aspx.vb:line 78


Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub
    Protected Sub Submit1_Click(ByVal sender

Unclosed quotation mark after the character string '

  

insert into quality_assurance (person_id, last_name) values ('"+id.text+"','"+last_name.text+"')

id.text and last_name.text are fields in our specialized scanning application and that's how you would extract the values in them to pass them into a sql server query.

The challenge now is that when the last_name.text = a name with a single quote, I get the error above "Unclosed quotation mark after the character string ' "

Any ideas?

 

 


Unclosed quotation mark after the character string ')

  
Hi,


I am getting the error "Unclosed quotation mark after the character string ')" with this code:

Code Snippet

cmd = New SqlCommand("INSERT INTO PRODUCT VALUES ('" & Me.TextBox1.Text & _
            "','" & Me.TextBox2.Text & "','" & Me.TextBox3.Text & "','" & Me.ComboBox.Text & _
            "','" & Me.TextBox4.Text & "'"")", conn)


Do anyone know what's going wrong around Me.TextBox4.Text. Thanks.

Unclosed quotation mark after the character string ')

  

Hey!, I got a little problem in the web shop I am updating.

when a user wants to enter a item (say a city) like 's Hertogenbosch the page gives me the "unclosed quotation mark after character string" error.

Now i have been following multiple options  on the web, but since i am new to the whole asp.net and c# stuff i havent been able to get it to work.

Changing the whole thing to parameters is unfortunately not an option.

I hope anyone can help me with this.

 

Pierce

 

SqlCommand myCMD = new
 SqlCommand("insert into tmpCustomer (sessionid,firstname,namefix,surname,street,streetnumber,postalcode,city,nation,phonenumber,company,mail,payment,CustomerAlternateAddress,street2,streetnumber2,postalcode2,city2,CustomerOpmerking) values 
('"
+Session.SessionID+"','" +firstName.Value+"','" +nameFix.Value+"','" +surName.Value+"','" +street.Value+"','" +streetNumber.Value+

Problem with Removing Byte Order Mark in Beginning of XML generated by SQL

  

The problem:  --> When we Transmit our XML File to our trading partner they are complaining the first 3 bytes of the file contain ascii characters (239 (187) (191) ... and they are rejecting our File

These are non printable characters seemingly generated automatically by .net Framework.  Our process is the following:

1) We call a stored proceedure that generates sql via xml document object.  The insertion of the btye order seems to occur when converting the String to XML.  Does anyone know a way to prevent this "automatic" insertion of the byte order (non visble).

Private Function SaveXMLFile(ByVal sXML As String, ByVal sFile As String, ByVal sId As String) As Boolean
        Dim m_xmld As XmlDocument
        Dim bErr As Boolean = False

        'Create the XML Document
        m_xmld = New XmlDocument()


        Try

            Dim byteArray As Byte() = System.Text.Encoding.Unicode.GetBytes(sXML)
            Dim UTF8Bytes As Byte() = System.Text.Encoding.Convert(System.Text

Problem to group radio button across gridview rows

  
In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Regrading Sharpoint 2010 problem and solutions

  
http://emanonsolutions.blogspot.com/
We can write your question and problem on this blogger.you get ans.use.

This sharpoint 2010 problem solving threads

  
Hi friend,

you can use this thread to solving problem and solutions.

Virtual Path Problem

  

 I get the following error on last line below (working on remote host): 'E:\web\sfcascom\ls_admin/uploads/images/001.JPG' is not a valid virtual path,

Note that the slashes go in different directions

I've tried a number of things but nothing seems to work. Thanks-

 

Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.Web.UI.WebControls

Imports System.Drawing.Imaging.ImageCodecInfo
Partial Class Protected_imageupload
    Inherits System.Web.UI.Page
    Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        ' Initialize variables
        Dim sSavePath As String
        Dim sThumbExtension As String
        Dim intThumbWidth As Integer
        Dim intThumbHeight As Integer
        Dim sFilename As String = ""
        ' Set constant values
        'sSavePath = "images/"
        sSavePath = Server.MapPath("~/") + "ls_admin/uploads/images/"



        sThumbExtension = "_thumb"
        intThumbWidth = 160
        intThumbHeight = 120

        ' If file field isn?t empty
        If FilUpload.PostedFile IsNot Nothing Then
            ' Check file size (mustn?t be 0)
            Dim myFile As Http

Strange Photo upload problem

  

I'm working project it's live on shared hosting

we'er uploading photos to a file on the server everything works fine the photo is resized renamed and sent to the folder

the upload page returns the thumbnail and the full size photo it's there all the photos have to be approved by an admin

twice now after they have been approved they disapear I checked the folder they are not there could there be anywhere

on the server they could get hung up before they go into the folder I have it setup so when you delete the data base entry it deletes the photo from the folder othe than that you need to open the folder and delete the photo this has hapened twice now I tried to recreate it with no luck

thaks for your help in advance


ASP.Net Caching problem ??

  

I'm having a problem with an asp.net 3.0 application using a gridview to display data.  The problem seems to be that despite a brand new .selectCommand being sent to the sqlDataSource, the gridview starts displaying data from *someone else's* query.  For example, user A is logged in and will be working fine until a few page submissions later when the gridview data starts suddenly showing information that belongs to another user. 

This is my first asp.net application, though I've been working with classic asp and ADO for years so I'm used to sending a SQL string and getting back the results from that string.  Apparently there is a complex caching system which is interferring which I do not at all understand so at this point I just want to stop the server from caching any data whatsoever.  Is this possible?

Any and all help will be much appreciated!!


Could some one tell me whats the Problem with this String Manipulation ??? C#.net

  

Hi.,

I store some values from code behind to a label which is Hidden !

<asp:Label ID="lbl_Hidden" runat="server" Visible = "false"></asp:Label>

and at the page load event i retrieve the value of the label & assign it to a string !

stringvalue = lbl_Hidden.Text;

Now i dont know why this manipulation does'nt work !

I've a character 'A' in the string and i'm unable to replace it with a space !

stringvalue.Replace(A, " ");

Wot do u think abt it ????


Categories: 
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