'Too many characters' error in sql string - working in SQL management studio but not in code behind???

Hello i constructed the following query in SQL management studio and it runs fine, exactly how i want it to. However when i run it in my code behind i get the error: 'Too many characters in character literal'

I desperatly need to use this query exactly how it displays in the mangement tool - why wont it work the same in my code behind?

(I am using c# in my code behind and binding the results of the query to a gridview)

Regards

"SELECT DISTINCT (dbo.AuthorList(publicationID))+ ';' + ISNULL(' Editor: '+Publication.editor, '')+ '' + ISNULL(' "'+Publication.title+'"', '')+ '' + ISNULL(' Book: "'+Publication.booktitle+'"', '')+ '' + ISNULL(' '+Publication.type, '')+ '' + ISNULL(' '+Publication.journal, '')+ '' + ISNULL(' Series: '+Publication.series+'.', '')+ '' + ISNULL(' '+Publication.school, '')+ '' + ISNULL(' '+Publication.institution, '')+ '' + ISNULL(' '+Publication.organisation, '')+ '' + ISNULL(' '+Publication.month, '')+ '' + ISNULL(' ('+convert(nvarchar, Publication.year)+')', '')+ '' + ISNULL(' '+Publication.publisher, '')+ '' + ISNULL(' '+Publication.address+'.', '')+ '' + ISNULL(' '+Publication.howpublished, '')+ '' + ISNULL(' Ed: '+convert(nvarchar, Publication.edition)+'.', '')+ '' + ISNULL(' '+Publication.note, '')+ '' + ISNULL(' Vol:'+Publication.volume+'.', '')+ '' + ISNULL(' No:'+Publication.number+'.', '')+ '' + ISNULL(' Pages:'+Publication.pages+'.', '')+ '' + ISNULL(' Chapter:'+Publication.chapter+'.', '') AS SingleColumn, Publication.publicationID FROM Publication;"

 

 

0
gcp2985
1/26/2008 2:04:55 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies
947 Views

Similar Articles

[PageSpeed] 10

I guess single quote and double quote characters overlapping.


Mark replies as answers if they helped you solve the problem.
0
siva_sm
1/26/2008 3:28:07 PM
Reply:

Similar Artilces:

An error occurred during the execution of the SQL file 'InstallRoles.sql'.
    Error text:An error occurred during the execution of the SQL file 'InstallRoles.sql'. The SQL error number is 446 and the SqlException message is: Cannot resolve collation conflict for equal to operation.Cannot resolve collation conflict for equal to operation.Error occurred when running 'aspnet_regsql -S servername -E -d database -A r'with previously installed mambership scheme on database.When googling on this issue, one post on forums.asp.net is listed but link is dead...please help...     Bartul Bonacic - NETMedia ADDITION:Also I forgot to ment...

what's difference between Accesss DataBase and Sql Sever about Sql String(or Command),Sql StoreProcedure ?
i am being dirty to Access DataBase from Sql Sever Database for my new work.But the sql string of Access sounds like a little different,can i use  the sql string of SqlSever for Access database,too?another question is: Does Access DataBase support Sql StoreProcedure??? when i worked in Access2000 ,did not see any about StoreProcedure,but i download a file named AccessHelper.cs  , some function of it looks like support StoreProcedure,Does it?  i want to fly ... Hi dkzeng ,Your first question     The string of both sqlsever and acce...

Dynamic read width from SQL, show error message: Cannot convert type 'string' to 'System.Web.UI.WebControls.Unit'
 I wrote new post, here is my code, just simple page show big image with dynamic width and height, but somehow the Width='<%# Eval("GalleryImageWidth")  %>' does not work. people in here give me some sugestion like : Width='<%# Eval("GalleryImageWidth")  + "px" %>' or  Width='<%# Convert.ToInt32("GalleryImageWidth") %>' or any body can tell what's wrong with my code?>>>>>>>>>>>>>>>>>>>>>>>>>>>>&...

SQL replace '-' by ''
Hi all i have a question regarding sql, i want to replace some characters...   any knows simply how to do this?   I want to replace "999-25000-69" by "9992500069"   grtzDon't forget to click "Mark as Answer" on the post that helped you. SELECT Replace('999-25000-69','-', '') or SELECT Replace(col1,'-', '') as col1 FROM yourTableLimno...

'XXX\ASPNET' user fight against SQL management studio express ... I'm crying! :(
Hi,I'm novev with .NET technology and I'm going mad.I've istalled DNN portal on my machine for developing a customized portal. ( I use ASP.NET2 framework with SQLexpress 2005 ) All worked (almost) well until I've started to use SQL Management Studio Express to access at the db.From that moment i'm in hell because of the following error: Server Error in '/Portal' Application. Impossibile aprire il database utente predefinito. Accesso non riuscito.Accesso non riuscito per l'utente 'MyMACHINE\ASPNET'. ...

All SELECT INTO's (inline SQL) causing SQL errors with PB11.5 (SQLOLEDB) on Vista/SQL 2000
Hello all- I recently migrated a PowerBuilder app to 11.5 on a box running Vista and SQL Server 2000. I believe the DB Profile is correctly set up since I can use the Database painter and query the tables with no issue. However, if I open any script that contains any inline SQL (SELECT/INTO's), the scripts won't compile and the SQL error 42000 is thrown. Strangely, the app runs fine and the inline SQL seems to execute successfully at run-time, but in the script views, something appears to be wrong. Here is my db profile I have setup for development: // Profile <...

Can't connect to SQL 2005 Express with SQL Server Management Studio Express
I've seen the following error posted when people try to connect to their server via their applications but didn't see anyone having problems when trying to connect with SQL Server Management Studio Express. Am I missing something here? This is the error:<<An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)(Microsoft SQL Server, Erro...

sp_hook_dbmlsync_download_fatal_sql_error, 'SQL error code' is zero
sometimes in sp_hook_dbmlsync_download_fatal_sql_error hook i get value 'SQL error code' is zero or 'table name' is empty, but in dbmlsync message log file i see non zero SQL error code, like 'SQL statement failed: (-828)'. it is bug in hook procedure? ASA 9.0.2.3496, winxpsp2 "Mars" <zmarsNO@SPAMzmail.ru> wrote in news:471c4e23$1@forums-1-dub of sybase.public.sqlanywhere.mobilink: M> sometimes in sp_hook_dbmlsync_download_fatal_sql_error hook i get M> value 'SQL error code' is zero or 'table name' is empty...

Microsoft OLE DB Provider for SQL Server error '80004005'. SQL Server does not exist or access denied.
Hi,I have a asp web application, where i use sql server 2005 as backend. This application generates reports . Before i was using SQL Server 2000, now its migrated to 2005. When i generate report for small date range then it works fine. But when the date range is big then around half of the report is generated and the following error is thrown. Microsoft OLE DB Provider for SQL Server error '80004005' [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. ...out.asp, line 405  Am sure the webcode is working fine and am connecting to the Da...

T-SQL what that string ''99999999-9999-9999-9999-999999999999''' mean ?
hi, I have a question about one t-SQL. exec('use ['+@db_Name+'] update Account.Q6_Account set TaxCodeID=null where len(TaxCode)=0 and TaxCodeID=''99999999-9999-9999-9999-999999999999''');  that TaxCodeID field is guid what that string ''99999999-9999-9999-9999-999999999999''' mean ? that means if TaXcodeID that fields equal to that illegal  Vale ''99999999-9999-9999-9999-999999999999''  and  len(TaxCode)=0 then set TaxCodeID=null?  or is there anyother meaning?   I interpreted the SQL...

[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database requested in login 'WinFM SQL PFS'. Login fails.
HiASP pages were properly connecting to SQL DB until I restored from a backup DB.  As soon as I finished restoring from the backup DB, I am getting the following error message.   I did not make any changes on ASP side.  IIS Server and SQL 2K Server is running on a WIN2K Server Box.Please help.Thank you.HTTP 500.100 - Internal Server Error - ASP errorInternet Information ServicesTechnical Information (for support personnel)Error Type:Microsoft OLE DB Provider for ODBC Drivers (0x80004005)[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database requested in login...

[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
Hello All, I'm Getting the following error when calling a dll from my vb.net application. [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. The dll was written in vb6 and accesses a sql db using the following connection string. Public Const GLOBAL_DNS As String = "DSN=TransSrvFinal;UID=sa;PWD=admin;" This DLL works fine when called from other Windows Apps. However I'm now trying to call this dll from with in an asp.net application. I'm using vb.net as the codebehind. I'm a...

wegconfig connectionstring ADODB System.Data.Odbc error is [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'TSQL'
    <add name="MYADODBCUSTOMERCONNECTIONSTRING" connectionString="Driver={SQL Server};Server=xxx.xxx.xxx.xxx;Database=myDbname;Uid=xxxxx;Pwd=xxxxx" providerName="System.Data.Odbc" />   [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'TSQL'. 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.Runtime.InteropServices.COMException: [Micros...

Database copy is only 'partial' with Sql Server Management Studio?
I am trying to move a MS SQL database for a MS SQL server 2000 to a MS SQL Server 2005.The database contains essentially ASP.NET profile data. I have no problem to perform the database copy with the Sql Server Management Studio. But it seems that the database Roles have not been copied along with the tables.How do I achieve to a complete database migration?Thanks in advance,Joannes...

Mobilink Synchronisation in SQL 11 error: Table 'employee' is referenced by publication 'ul_no_pub'
SQL Anywhere 11.0.0.1549 Hi all, I am converting our Mobilink synchronisation from 9.0.2. to 11.0.0.1549. Currently I am getting these types of error messages: I. 2009-02-09 09:30:17. <4> Table 'employee' is referenced by publication 'ul_no_pub' I. 2009-02-09 09:30:17. <4> Table #43: gangMember, 5 columns I. 2009-02-09 09:30:17. <4> Column #1: varchar(20) NOT NULL PRIMARY KEY I. 2009-02-09 09:30:17. <4> Column #2: varchar(1) NOT NULL PRIMARY KEY I. 2009-02-09 09:30:17. <4> Column #3: varchar(10) NOT NULL PRIMARY KEY I. 2009-02-09...

Web resources about - 'Too many characters' error in sql string - working in SQL management studio but not in code behind??? - asp.net.sql-datasource

Resources last updated: 12/27/2015 4:24:47 PM