Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
wengang
Starting Member
4 Posts |
Posted - 2005-09-26 : 03:16:00
|
| Hi all.I'm having a strange problem with a stored procedure.To start the SP looks like this@ID intselect * from tblArticles where articleID = @IDI can run this as an sql query on my ASP page and it returns the single record with all data intact. I can also run the sql query in Query Analyzer and it returns the same. And I can run the SP in QA as:GetArticle 16670 --(for example)But, the strange part, when I run the stored procedure from my ASP page, several of the data fields come back blank. and what's more, it isn't the same data fields that come back blank, depending on which one I call first in my ASP code.Here is one way I called the SP:SET rs6=CreateObject("ADODB.Recordset")rs6.Open "GetArticle 16670",connSSHere is another way (as recommended by friends at vbforums.com)set objCmd=Server.CreateObject("ADODB.command")with objCmd.CommandText = "GetArticle".ActiveConnection = ConnSS.CommandType = adCmdStoredProc.Parameters.Append objCmd.CreateParameter("@Id", adInteger, adParamInput,,16670)end withSet rs6 = objCmd.Execute()But in both cases I have the same problem:response.write rs6("Text") & "<br>"response.write rs6("publishdate") & "<br>"response.write "source: " & rs6("source") & "<br>"with the above 3 lines of code, the first two lines print out data, but the third line (source) prints out blank (tested by adding the word "SOURCE:" to make sure it was writing)to add to the strangeness, I switched the lines around:response.write "source: " & rs6("source") & "<br>"response.write rs6("publishdate") & "<br>"response.write rs6("Text") & "<br>"and this time, the first two lines print their values and the third line is blank (just as before) but since I switched the column names, it is now the "Text" column that shows blank.I can't figure this out. Why are some fields coming back blank? Why are they different depending on which was referenced first?I need any possible reasons/suggestions for this problem.For reference, here is a listing of the entire table structure:ArticleID INT IDENTITYTITLE NVARCHAR 250HTML NTEXTTEXT NTEXTFILENAME NVARCHAR 200SOURCE NVARCHAR 600PUBLISHDATE DATETIMESTATUS INTVIEWS INTSTATSMAIN INTSTATSMONTH INTSTATSYEAR INTLANG INTTOPSTORY BITHAVEIMAGE BITHAVETABLE BITTEXT1 NVARCHAR 4000FILTERS VARCHAR 100EMAIL BITthe reason i use nvarchar and ntext instead of varchar and text is that these columns may contain Japanese and Chinese characters.I've never seen this problem before but it is consistent and I can't find anything in the code that would cause this strange behavior.Ideas?ThanksWengang |
|
|
|
|
|
|
|