|
-
Nov 19th, 2006, 11:00 PM
#1
Thread Starter
Addicted Member
[RESOLVED] when dataset executes stored proc..error
Hello all,
I currently have the below code, which is used to execute a data adapter fill method...
currently it executes a stored procedure. however, when no results are returns, it gives an error. the procedure doesnt need to give any results, as its a search function.
here is the code below.
VB Code:
Public Shared Function SearchDocuments(ByVal Query As String, ByVal SearchString As String) As Document()
Dim dtaLayer As New DataLayer
Dim htParameters As New Hashtable
htParameters.Add("@searchString", SearchString)
Dim dtaSet As DataSet = dtaLayer.ReturnParametisedDataSet(Query, htParameters)
Dim objDocuments(dtaSet.Tables(0).Rows.Count - 1) As Document
For i As Integer = 0 To dtaSet.Tables(0).Rows.Count - 1
Dim objDocument As New Document
objDocument.DocumentCode = Convert.ToString(dtaSet.Tables(0).Rows(i)("document_code"))
objDocument.Title = Convert.ToString(dtaSet.Tables(0).Rows(i)("document_title"))
objDocument.Description = Convert.ToString(dtaSet.Tables(0).Rows(i)("document_description"))
objDocument.Category = Convert.ToString(dtaSet.Tables(0).Rows(i)("category_title"))
objDocument.DateAdded = Convert.ToDateTime(dtaSet.Tables(0).Rows(i)("document_date_added"))
objDocument.DateOfRevision = Convert.ToDateTime(dtaSet.Tables(0).Rows(i)("document_date_revision"))
objDocument.DateLastRevised = Convert.ToDateTime(dtaSet.Tables(0).Rows(i)("document_last_revised"))
objDocument.Author = Convert.ToString(dtaSet.Tables(0).Rows(i)("document_author"))
objDocument.Version = Convert.ToString(dtaSet.Tables(0).Rows(i)("document_version"))
objDocuments(i) = objDocument
Next
Return objDocuments
End Function
how do i stop it from breaking when no results are returned.
Thanks, Justin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|