Showing posts with label type. Show all posts
Showing posts with label type. Show all posts

Friday, March 30, 2012

Investigate Unknown database file type?

hello guys,
i'm new on this forum, i got a file with .inn extension but have a problem while i want to access it. i've tried so many ways to access such that file.
The extension maybe masked by the developer for security reason, i try to change the extension to .dbf and .mdb to access it from odbc but still cannot access it.

please help me to investigate that file.
the file is included on the attachment

thanx in advance for all of your answer.

regards,
canfieldmysql innodb table?|||Perhaps Essbase Temporary Analytic Services index file?
Or Cobol/2 overlay?
(Found those two using Google service. Never heard about Essbase before ...)|||You may not be able to rescue this data.
The file seems to contain no data definitions (schema), therefore unless you have the originating program AND this program has some default/embedded definitions, then you maybe could access the data in this file.

Otherwise, it is useless to try and figure out data structures in a file which you do not have the design format.

:rolleyes:

Wednesday, March 28, 2012

Invalid Target name - how can it be determined?

Hi, I am sending a message to an invalid target name. The message eventually gets back to the initiator as an error type message. How can I determine the exact cause of the error - and determine that the target service name is invalid? I am using the ServiceBrokerInterface and the Message does not tell much - it seems. Also, in the sys.conversation_endpoints table, the record associated to the message only says 'Error', but no other indicator.

I found it - it is embedded as a stream in the Body property.|||

Right, the cast the response Error message_body to XML and the text will contain the problem service name.

HTH,
~ Remus

Monday, March 26, 2012

Invalid operator for data type. Operator equals boolean AND, type equals datetim

I am getting a error message saying: Invalid operator for data type. Operator equals boolean AND, type equals datetime.

I traced the pointer to @.gdo and @.gd, they are both dates!

INSERT INTO AdminAlerts values (CURRENT_USER, 'UPDATE', getDate(), @.biui, 'Updated booking, ID of booking updated: ' & @.biui & ', Booking date and time before/after update: ' & @.gdo & '/' & @.gd & ', Room number before/after update: ' & @.rno & '/' & @.rn & ' and Customer ID before/after update: ' & @.cio & '/' & @.ci)

If I cut that two dates out it works fine.
Could someone tell me the syntax to include a date in a string :confused:Another trouble, Now I also figure even I cancel the date variable out, I also get the Syntax error trying to convert varchar 'blah blah blah' into an int column.

INSERT INTO AdminAlerts values (CURRENT_USER, 'UPDATE', getDate(), @.biui, 'Updated booking, ID of booking updated: ' & @.biui & ', Booking date and time before/after update: ' & @.gdo & '/' & @.gd & ', Room number before/after update: ' & @.rno & '/' & @.rn & ' and Customer ID before/after update: ' & @.cio & '/' & @.ci)

I means the & @.biui & between Strings. @.biui, @.rno, @.rn are all int

Can someone give me some help pls?|||If I see it right you want to convert date and int into string. Try CAST or CONVERT, and use '+' to concatenate strings instead of '&' which is bitwise AND operation.|||Thanks!
It Works great!!

I have created a procedure which display all the record in a table.
How can I execute that in Access please? (I mean show the table in access)sql

Invalid operator for data type.

Kudos to y'all experts out there. I kinda needed your help. I'm trying to run a query...

SELECT a.AUF_POS AS Pos, c.ZL_STR AS Panel, a.POS_TEXT AS Description, a.BREITE AS W1, a.HOEHE

AS H1, a.BREITE2 AS W2, a.HOEHE2 AS H2, SUM(b.ANZ) AS Qty, SUM(b.LIEFER_ANZ) AS Dlvd,

SUM(b.RG_ANZ) AS Inv, (a.BREITE*a.HOEHE/CAST(1000000 AS NUMERIC)) AS UnitSQM,

(a.BREITE*a.HOEHE*SUM(b.ANZ)/CAST(1000000 AS NUMERIC)) as TotPosSQM

FROM liorder..LIORDER.AUF_POS a INNER JOIN liorder..LIORDER.AUF_STAT b ON a.AUF_NR = b.AUF_NR

AND a.AUF_POS = b.AUF_POS INNER JOIN liorder..LIORDER.AUF_TEXT c ON a.AUF_NR = c.AUF_NR AND

b.AUF_POS = c.AUF_POS

WHERE (c.ZL_MOD = 0) AND (b.AUF_NR = '86260')

GROUP BY a.AUF_POS, a.POS_TEXT, a.BREITE, a.BREITE2, a.HOEHE, a.HOEHE2, a.SFORM_NR, c.ZL_STR

...and I keep getting this error: Invalid operator for data type. Operator equals multiply, type equals nvarchar. I've tried every possible CAST and CONVERT but I just can't make it work. I'm pretty sure that the data types for the columns I mentioned on the mathematical equation are all numeric. Please help...Its going to be difficult for us to help without the DDL. Your query does alot of aggregrations (i.e. sum/avg/etc), thus you'd want to ensure that the column datatype is numeric.

Invalid operator for data type

What is wrong with this select statement?

SELECT lastName + ", " + firstName + " " + middleName as Name
FROM [users]
WHERE ([usrID] = 100)
I kept getting this error:

Msg 403, Level 16, State 1, Line 1
Invalid operator for data type. Operator equals add, type equals text.

Help is appreciated.

SELECT lastName + ', ' + firstName + ' ' + middleName as Name
FROM [users]
WHERE ([usrID] = 100)

|||Thanks! I tried that and got the same error.|||Please check your table definition for these columns. It seems that the data type for these columns cannot do the operation. If that is the case, change them to nvarchar(50) and then give it a try. I tested the code and it works.|||

mychucky:

What is wrong with this select statement?

Msg 403, Level 16, State 1, Line 1
Invalid operator for data type. Operator equals add, type equals text.

Take a look at the error message, it seems that your column(s) is defined to TEXT type, which can not be used with '+' operator. I agreed withlimno, you should change the data type to nvarchar if the column is not used to store large text. To manage TEXT data, you should use some functions. Take a look at 'Usingtext, ntext, and image Functions' topic in SQL2000 Books Online, or go to this link:

http://msdn.microsoft.com/library/en-us/acdata/ac_8_con_11_7zox.asp?frame=true

|||Many thanks for the help. Yes, I do have Text and varachar as thedatatype. So what is the best way to concatenate these columns?|||Change both data types to Varchar. Hope this helps.

Wednesday, March 21, 2012

Invalid length parameter passed to the substring function.

This is driving me absolutley crazy. This function returns ProductIDs stripped out from a memo field based on a check on Product Type (which is also stripped for the checking) and returns a list of ProductIDs based on the type I'm checking for, in other words the @.FileFormat

The error: Invalid length parameter passed to the substring function.

I am passing 2 types of ProductDescriptions to my function below. This function returns ProductIDs by Type, stripped out of a large varchar field. The problem I'm having is that I have 2 checks that check whether the ProductID is MP3 or WAV. The second check is failing.

The 2 types of possible incoming ProductDescriptions for example are:

'These fully-orchestrated royalty free music tracks invoke the spirit of some of the great themes from 1970"s and 1980"s television and film productions and offer majestic brass, string and guitar melodies that will make a memorable addition to projects as background music and production music.<br><br><span class="product-name-no-link">You can also purchase the individual tracks:</span><br><br>01. American Plains <a href="ProductInfo.aspx?ProductID=105234">MP3</a> | <a href="ProductInfo.aspx?ProductID=105235">WAV</a><br>02. Sultry Summer Night <a href="ProductInfo.aspx?ProductID=105236">MP3</a> | <a href="ProductInfo.aspx?ProductID=105237">WAV</a><br>03. Ocean Skyline <a href="ProductInfo.aspx?ProductID=105238">MP3</a> | <a href="ProductInfo.aspx?ProductID=105239">WAV</a><br>04. Wistful Lover <a href="ProductInfo.aspx?ProductID=105240">MP3</a> | <a href="ProductInfo.aspx?ProductID=105241">WAV</a><br>05. Final Choice <a href="ProductInfo.aspx?ProductID=105242">MP3</a> | <a href="ProductInfo.aspx?ProductID=105243">WAV</a><br>06. Fun and Free <a href="ProductInfo.aspx?ProductID=105244">MP3</a> | <a href="ProductInfo.aspx?ProductID=105245">WAV</a><br>07. Wayward Strangers <a href="ProductInfo.aspx?ProductID=105246">MP3</a> | <a href="ProductInfo.aspx?ProductID=105247">WAV</a><br>08. Savored Moments <a href="ProductInfo.aspx?ProductID=105248">MP3</a> | <a href="ProductInfo.aspx?ProductID=105249">WAV</a><br>09. Endless Searcher <a href="ProductInfo.aspx?ProductID=105250">MP3</a> | <a href="ProductInfo.aspx?ProductID=105251">WAV</a><br>10. Bach Piano <a href="ProductInfo.aspx?ProductID=105252">MP3</a> | <a href="ProductInfo.aspx?ProductID=105253">WAV</a><br>11. Fog Bound Mornings <a href="ProductInfo.aspx?ProductID=105254">MP3</a> | <a href="ProductInfo.aspx?ProductID=105255">WAV</a><br>'

OR

'Clapping percussion effects characterize this Hip Hop/Urban piece with train sound effects and strings.<br><br><b>Styles:</b> Dramatic,Reflective,Somber/dark<br><br><b>If you like this track, you can save more than <span style='color=#ff0000'>70%</span> by purchasing it on the following albums:</b><br><a href="ProductInfo.aspx?ProductID=106758">Hip-Hop / Urban</a><br><a href="ProductInfo.aspx?ProductID=106763">Documentary, Film, Television, General Production - Volume 2</a><br><br>Click <a href="ProductInfo.aspx?ProductID=105747">here</a> for the WAV version of this track.'

The current function I'm trying to fix:

ALTER FUNCTION [dbo].[GetProductChildIDs]

(

@.ProductDescription varchar(5500),

@.FileFormatvarchar(3)

)

RETURNS varchar(1000)

AS

BEGIN

Declare @.Keyword varchar(30),

@.KeywordLen tinyint,

@.ProductID int,

@.Pos smallint,

@.StartPos smallint,

@.EndPos smallint,

@.Result varchar(1000),

@.valid int

SET @.valid = 0

SET @.Keyword = 'ProductInfo.aspx?ProductID='

SET @.KeywordLen = LEN(@.Keyword)

SET @.Result = ''

SET @.Pos = 1

WHILE @.Pos > 0

BEGIN

SET @.Pos = CHARINDEX(@.Keyword, @.ProductDescription, @.Pos)

If @.Pos > 0

BEGIN

SET @.StartPos = @.Pos + @.KeywordLen

SET @.EndPos = CHARINDEX('"', @.ProductDescription, @.StartPos + 1)

IF SUBSTRING(@.ProductDescription, @.EndPos + 2, 3) = @.FileFormat

SET @.valid = 1

IF (len(@.ProductDescription) - @.StartPos) > 19

IF SUBSTRING(@.ProductDescription, @.EndPos + 19, 3) = @.FileFormat

SET @.valid = 1

IF @.valid = 1

BEGIN

SELECT @.Result = @.Result + SUBSTRING(@.ProductDescription, @.StartPos, @.EndPos - @.StartPos) + ','

END

SET @.Pos = @.EndPos + 1

END

END

RETURN SUBSTRING(@.Result,1,len(@.Result)-1)

END

The following checks to see whether the ProductID is WAV or MP3 by checking certain chars after each sequence 'ProductInfo.aspx?ProductID='

IF SUBSTRING(@.ProductDescription, @.EndPos + 2, 3) = @.FileFormat - checks if it's a 'WAV' or 'MP3' based on the first type of incoming ProductDescription passed to this function at any time

IF SUBSTRING(@.ProductDescription, @.EndPos + 19, 3) = @.FileFormat - checks to see if it's a 'WAV' or 'MP3' ProductID based on the second type of possible incoming ProductDescription.

I found out that the second check fails if there isn't 19 or more chars to check so I tried putting this in:

So I'm not sure how to handle the Nulls in the second IF statement if there are not enough chars to check in the loop for each SUBSTRING(@.ProductDescription, @.EndPos + 19, 3)

ALTER FUNCTION [dbo].[GetProductChildIDs]

(

@.ProductDescription varchar(5500),

@.FileFormatvarchar(3)

)

RETURNS varchar(1000)

AS

BEGIN

Declare @.Keyword varchar(30),

@.KeywordLen tinyint,

@.ProductID int,

@.Pos smallint,

@.StartPos smallint,

@.EndPos smallint,

@.Result varchar(1000),

@.valid int

SET @.valid = 0

SET @.Keyword = 'ProductInfo.aspx?ProductID='

SET @.KeywordLen = LEN(@.Keyword)

SET @.Result = ''

SET @.Pos = 1

WHILE @.Pos > 0

BEGIN

SET @.Pos = CHARINDEX(@.Keyword, @.ProductDescription, @.Pos)

If @.Pos > 0

BEGIN

SET @.StartPos = @.Pos + @.KeywordLen

SET @.EndPos = CHARINDEX('"', @.ProductDescription, @.StartPos + 1)

IF SUBSTRING(@.ProductDescription, @.EndPos + 2, 3) = @.FileFormat

SET @.valid = 1

IF (len(@.ProductDescription) - @.StartPos) > 19

IF SUBSTRING(@.ProductDescription, @.EndPos + 19, 3) = @.FileFormat

SET @.valid = 1

--IF @.valid = 1

BEGIN

SELECT @.Result = @.Result + SUBSTRING(@.ProductDescription, @.StartPos, @.EndPos - @.StartPos) + ','

END

SET @.Pos = @.EndPos + 1

END

END

RETURN SUBSTRING(@.Result,1,len(@.Result)-1)

END

|||

I since then have figured it out by extensive testing and added some stuff so that it will behave...but let me take a look at what you had to suggest also. Thanks for the suggestion though!

ALTER FUNCTION [dbo].[GetProductChildIDs]

(

@.ProductDescription varchar(5500),

@.FileFormat varchar(3)

)

RETURNS varchar(1000)

AS

BEGIN

Declare @.Keyword varchar(30),

@.KeywordLen tinyint,

@.ProductID int,

@.Pos smallint,

@.StartPos smallint,

@.EndPos smallint,

@.Result varchar(1000),

@.ResultToReturn varchar(1000),

@.valid int,

@.MP3Pos int,

@.WavPos int

SET @.valid = 0

SET @.Keyword = 'ProductInfo.aspx?ProductID='

SET @.KeywordLen = LEN(@.Keyword)

SET @.Result = ''

SET @.ResultToReturn = ''

SET @.Pos = 1

WHILE @.Pos > 0

BEGIN

SET @.Pos = CHARINDEX(@.Keyword, @.ProductDescription, @.Pos)

If @.Pos > 0

BEGIN

SET @.StartPos = @.Pos + @.KeywordLen

SET @.EndPos = CHARINDEX('"', @.ProductDescription, @.StartPos + 1)

IF SUBSTRING(@.ProductDescription, @.EndPos + 2, 3) = @.FileFormat

BEGIN

SET @.valid = 1

END

IF SUBSTRING(@.ProductDescription, @.EndPos + 19, 3) = @.FileFormat

BEGIN

SET @.valid = 1

END

IF @.valid = 1

BEGIN

SELECT @.Result = @.Result + SUBSTRING(@.ProductDescription, @.StartPos, @.EndPos - @.StartPos) + ','

END

SET @.Pos = @.EndPos + 1

END

END

IF len(@.Result) > 6

SET @.ResultToReturn = @.ResultToReturn + SUBSTRING(@.Result,1,len(@.Result)-1)

RETURN @.ResultToReturn

END

|||why did you comment out the If @.valid = 1?

Monday, March 19, 2012

Invalid descriptor index

Good day
I have a simple transactional replication set up between two SQL2000
servers. A single table is replicated with columns of type int, bit and
varchar. The server with the subscription has had SP3 for quite some time,
however after we installed SP3 on the publishing server, we started receiving
an "Invalid descriptor index" error when trying to start the distribution
agent on the publishing server.
Does anyone have an idea why this would happen and how to fix this problem?
Thanks
I have removed the replication and set it up again, however I am still
receiving the invalid descriptor index error...?
"Pieter" wrote:

> Good day
> I have a simple transactional replication set up between two SQL2000
> servers. A single table is replicated with columns of type int, bit and
> varchar. The server with the subscription has had SP3 for quite some time,
> however after we installed SP3 on the publishing server, we started receiving
> an "Invalid descriptor index" error when trying to start the distribution
> agent on the publishing server.
> Does anyone have an idea why this would happen and how to fix this problem?
> Thanks

Invalid Data Type error with Subreports

I have a report with two subreports. The parameter connecting the report with the subreports is based on a field with a datatype of UniqueIdentifier.

If I run each of the subreports by themselves, entering in value for the parameter, they run fine.

When I try to run the master report, it runs, but the subreport sections contain the following text instead of the correct output: "Error: Subreport could not be shown." The Output window shows 2 warning, one for each subreport:

The expression use in subreport 'subreport1' returned a data type that is not valid.

I don't know for a fact that it is the parameter causing the problem, because the error message has a blank for the expression that is having the problem.

Each subreport is a simple table with one column containing string fields from a simple query.

Anyone have any ideas?It sounds like you are trying to pass GUIDs as parameters to the subreport.
On the subreport parameters dialog, use the CStr(...) function to convert the Guids to strings. E.g. =CStr(Fields!GuidColumn.Value)

-- Robert|||Guys:

I am having the same problem. I tried the CStr() function on the parameters to the SubReport, but had the same result. Any more ideas?

Thanks,
Mike|||Whoops! I am getting a different error when using the CStr() function:

Cast from type 'Guid' to type 'String' is not valid.

|||

I think I originally tried Robert's suggestion and was still giving an error like you found.

What I ended up doing was going into the queries for both the master and sub report and using "(CAST ScriptID AS varchar(255))" in the queries themselves. Then, these string fields linked up without a problem.

Gregg

|||Sorry, I meant using =Fields!GuidColum.Value.ToString() to convert it into a string. Anyway, the CAST in the query is also fine.

-- Robert

Invalid Data Type error with Subreports

I have a report with two subreports. The parameter connecting the report with the subreports is based on a field with a datatype of UniqueIdentifier.

If I run each of the subreports by themselves, entering in value for the parameter, they run fine.

When I try to run the master report, it runs, but the subreport sections contain the following text instead of the correct output: "Error: Subreport could not be shown." The Output window shows 2 warning, one for each subreport:

The expression use in subreport 'subreport1' returned a data type that is not valid.

I don't know for a fact that it is the parameter causing the problem, because the error message has a blank for the expression that is having the problem.

Each subreport is a simple table with one column containing string fields from a simple query.

Anyone have any ideas?It sounds like you are trying to pass GUIDs as parameters to the subreport.
On the subreport parameters dialog, use the CStr(...) function to convert the Guids to strings. E.g. =CStr(Fields!GuidColumn.Value)

-- Robert|||Guys:

I am having the same problem. I tried the CStr() function on the parameters to the SubReport, but had the same result. Any more ideas?

Thanks,
Mike|||Whoops! I am getting a different error when using the CStr() function:

Cast from type 'Guid' to type 'String' is not valid.

|||

I think I originally tried Robert's suggestion and was still giving an error like you found.

What I ended up doing was going into the queries for both the master and sub report and using "(CAST ScriptID AS varchar(255))" in the queries themselves. Then, these string fields linked up without a problem.

Gregg

|||Sorry, I meant using =Fields!GuidColum.Value.ToString() to convert it into a string. Anyway, the CAST in the query is also fine.

-- Robert

Invalid Data Type error with Subreports

I have a report with two subreports. The parameter connecting the report with the subreports is based on a field with a datatype of UniqueIdentifier.

If I run each of the subreports by themselves, entering in value for the parameter, they run fine.

When I try to run the master report, it runs, but the subreport sections contain the following text instead of the correct output: "Error: Subreport could not be shown." The Output window shows 2 warning, one for each subreport:

The expression use in subreport 'subreport1' returned a data type that is not valid.

I don't know for a fact that it is the parameter causing the problem, because the error message has a blank for the expression that is having the problem.

Each subreport is a simple table with one column containing string fields from a simple query.

Anyone have any ideas?It sounds like you are trying to pass GUIDs as parameters to the subreport.
On the subreport parameters dialog, use the CStr(...) function to convert the Guids to strings. E.g. =CStr(Fields!GuidColumn.Value)

-- Robert|||Guys:

I am having the same problem. I tried the CStr() function on the parameters to the SubReport, but had the same result. Any more ideas?

Thanks,
Mike|||Whoops! I am getting a different error when using the CStr() function:

Cast from type 'Guid' to type 'String' is not valid.

|||

I think I originally tried Robert's suggestion and was still giving an error like you found.

What I ended up doing was going into the queries for both the master and sub report and using "(CAST ScriptID AS varchar(255))" in the queries themselves. Then, these string fields linked up without a problem.

Gregg

|||Sorry, I meant using =Fields!GuidColum.Value.ToString() to convert it into a string. Anyway, the CAST in the query is also fine.

-- Robert

Friday, March 9, 2012

Invalid character value for cast specification

Hi: gurus,
I am using sqlxml3.0 to bulkload to insert the data to SQLServer. Every
thing works fine if I don't use the datetime type column in sql. If I use the
datetime column in sql I am getting this message "Invalid character value for
cast specification"
Here is my XSD, I am not sure how to map sql annotation for date time field
"effdate" (do I have to) for this XSD. I will really appreciate your response.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:element name="BillerInfo" sql:relation="BillerInfo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="blrid" type="xsd:string"/>
<xsd:element name="acdind" type="xsd:string"/>
<xsd:element name="effdate" type="xsd:dateTime"/>
<xsd:element name="trnaba" type="xsd:string"/>
<xsd:element name="billername" type="xsd:string"/>
<xsd:element name="billerclass" type="xsd:string"/>
<xsd:element name="dmpprenote" type="xsd:boolean"/>
<xsd:element name="dmppayonly" type="xsd:boolean"/>
<xsd:element name="blroldname" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
I guess the problem most likely lies in your data file. I assume that you
have a datetime value which is not matching with the xsd:dataTime format.
If you don't have the control on the input data, you may specify xsd:string
instead of xsd:dataTime.
Thanks.
"Rashid" <Rashid@.discussions.microsoft.com> wrote in message
news:FE70E9A6-B2AF-4BD4-B0DC-88425795A2F1@.microsoft.com...
> Hi: gurus,
> I am using sqlxml3.0 to bulkload to insert the data to SQLServer. Every
> thing works fine if I don't use the datetime type column in sql. If I use
the
> datetime column in sql I am getting this message "Invalid character value
for
> cast specification"
> Here is my XSD, I am not sure how to map sql annotation for date time
field
> "effdate" (do I have to) for this XSD. I will really appreciate your
response.
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
> <xsd:element name="BillerInfo" sql:relation="BillerInfo">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="blrid" type="xsd:string"/>
> <xsd:element name="acdind" type="xsd:string"/>
> <xsd:element name="effdate" type="xsd:dateTime"/>
> <xsd:element name="trnaba" type="xsd:string"/>
> <xsd:element name="billername" type="xsd:string"/>
> <xsd:element name="billerclass" type="xsd:string"/>
> <xsd:element name="dmpprenote" type="xsd:boolean"/>
> <xsd:element name="dmppayonly" type="xsd:boolean"/>
> <xsd:element name="blroldname" type="xsd:string"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
>

Wednesday, March 7, 2012

Invalid attempt to read when no data is present

I am using a standard dbreader type of loop in a query to retrieve data. I am running over what should be end of record set, every time.

I have altered my read procedures to use while dbreader.read() and if dbreader.read(), to attempt to avoid getting the error. Neither is stopping it.

While debugging it, as I get to the last item and actually get the error, if I check the dbreader status, it still indicates that it has rows.

Anyone have any ideas on how to get around this?

TIA, Tom

Can you post your code?
|||

Sure can. The below posted is the whole thing. The sqlcommand, connection, etc. should be irrelavant.

' get the data from the database and pass it back.

Function getTheData(ByVal cmd As String) As DataTable

' note that the passed cmd is the below sqlString

Dim sqlString As String = "SELECT CONVERT(char(20), Date, 107) AS Date, City, State, Company, Position, JobNumber, Row_Number() Over (ORDER BY JobNumber DESC) as Item FROM JobsDB "

' define the new datatable to hold our results

dt = New DataTable("Jobs")

' define the columns we will be saving

Dim dcIt As New DataColumn("Item", GetType(String))

Dim dcDt As New DataColumn("Date", GetType(String))

Dim dcCt As New DataColumn("City", GetType(String))

Dim dcSt As New DataColumn("State", GetType(String))

Dim dcJN As New DataColumn("JobNumber", GetType(Integer))

Dim dcKW As New DataColumn("KeyWords", GetType(String))

Dim dcPos As New DataColumn("Position", GetType(String))

Dim dcCo As New DataColumn("Company", GetType(String))

' add columns

dt.Columns.Add(dcIt)

dt.Columns.Add(dcDt)

dt.Columns.Add(dcCt)

dt.Columns.Add(dcSt)

dt.Columns.Add(dcJN)

dt.Columns.Add(dcKW)

dt.Columns.Add(dcPos)

dt.Columns.Add(dcCo)

' define datarow

Dim dr As DataRow

' build sql command info

sqlCmd = New SqlCommand

sqlCmd.Connection = sqlConn

sqlCmd.CommandType = CommandType.Text

sqlCmd.CommandText = sqlString

Try

sqlConn.Open()

dbReader = sqlCmd.ExecuteReader()

If dbReader.HasRows Then

While dbReader.Read() 'this can be changed to if dbreader.read(), no diff

' build the data table item from the database

dr = dt.NewRow()

dr("Item") = dbReader.Item("Item").ToString()

dr("Date") = dbReader.Item("Date").ToString()

dr("City") = dbReader.Item("City").ToString()

dr("State") = dbReader.Item("State").ToString()

dr("JobNumber") = dbReader.Item("JobNumber").ToString()

dr("Position") = dbReader.Item("Position").ToString()

dr("Company") = dbReader.Item("Company").ToString()

dr("KeyWords") = keywords

dt.Rows.Add(dr)

End While

Else

lblNoData.Visible = True

End If

Catch ex As Exception

Dim exMsg As String = Request.ServerVariables("Script_Name") + ", getTheData(cmd=" & sqlString & "): msg=" + ex.Message.ToString()

utils.writeApplicationLog(exMsg, System.Configuration.ConfigurationManager.AppSettings("UtilityDbName"))

Response.Redirect(ConfigurationManager.AppSettings("errorPage") & ConfigurationManager.AppSettings("errCatchAll") & "&return=" & Request.ServerVariables("Script_Host"))

End Try

Return dt.Copy

End Function

Thanks, Tom

|||The code worked for me using sample data.

Some thoughts: Make the declarations of sqlConn, sqlCmd, and dbReader local to the function instead of global. Add a Finally section that contains dbReader.Close, sqlConn.Close, and sqlConn.Dispose.

If that doesn't change anything, is it possible that there's something in your data that is causing the problem?