I have the following:
SelectPage: simply prompt user for a year string
Here's my func in clsACData: this func suppose to generate result pulling off from a sql statement where the year is input from the select page.
Everything seems to work just fine if I hard code the year in my sql statement (my page is generated with the result I'm looking for), but doesn't work when prompting user for input. It fails on:
It seems to stop at the sql statement where the year input is blank...even though I did put in the value.
Any thoughts or input is appreciated.
SelectPage: simply prompt user for a year string
VB.NET:
Public ReadOnly Property FindValue() As String
Get
FindValue = TextBox1.Text & " "
End Get
End Property
Protected Sub btnFind_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFind.Click
Dim rpData As New clsACData
rpData.GetDeceasedReport(FindValue())
End Sub
Here's my func in clsACData: this func suppose to generate result pulling off from a sql statement where the year is input from the select page.
VB.NET:
Public Function GetDeceasedReport(ByVal dDate As String) As DataTable
Dim strRegNames As String = "SELECT Folder.FolderID, Folder.FirstName, Folder.LastName, Address.Address1, Address.City, Address.State,
Address.Zip, Address.PrimaryPhone, Folder.DeathDate, Folder.BirthDate FROM Folder
INNER JOIN Address ON Folder.FolderID = Address.FolderID
WHERE year(Folder.DeathDate)= " & dDate
Dim vContinue As Boolean = False
Dim temprp As New Metafile.ResultsPlus.Results
Dim strResult As String()
Dim dt As New DataTable()
If temprp.Initialize(rpUID, rpPWD, rpServer, rpDatabase, Metafile.ResultsPlus.Results.RpDBType.ESqlServer, sqlUID, sqlPWD, 30, rpPort) Then
vContinue = True
End If
'Try
If vContinue Then
dt.Columns.Add("ID", GetType(Integer))
dt.Columns.Add("FirstName", GetType(String))
dt.Columns.Add("LastName", GetType(String))
dt.Columns.Add("RetreantAddress", GetType(String))
dt.Columns.Add("City", GetType(String))
dt.Columns.Add("State", GetType(String))
dt.Columns.Add("ZipCode", GetType(String))
dt.Columns.Add("PhoneNumber", GetType(String))
dt.Columns.Add("DeathDate", GetType(String))
dt.Columns.Add("BirthDate", GetType(String))
strResult = temprp.ListOpenSQL(strRegNames, -1)
For i As Integer = 0 To strResult.Length - 1
Dim dr As Data.DataRow
Dim resultFields() As String = Split(strResult(i), vbTab)
dr = dt.Rows.Add(resultFields)
Next
End If
GetDeceasedReport = dt
' Catch ex As Exception
'Throw
'End Try
End Function
Incorrect syntax near '='.
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.Data.SqlClient.SqlException: Incorrect syntax near '='.
Source Error:
Line 807: dt.Columns.Add("BirthDate", GetType(String))
Line 808:
Line 809: strResult = temprp.ListOpenSQL(strRegNames, -1)
Line 810: For i As Integer = 0 To strResult.Length - 1
Line 811: Dim dr As Data.DataRow
It seems to stop at the sql statement where the year input is blank...even though I did put in the value.
Any thoughts or input is appreciated.
Last edited by a moderator: