G
Guest
I created a new Web app and added a label and a button to the page.
I added the following code which compiles and executes correctly and returns
records:
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim OracleSelectCommand1 As System.Data.OracleClient.OracleCommand
Dim OracleConnection1 As System.Data.OracleClient.OracleConnection
Dim OracleDataAdapter1 As System.Data.OracleClient.OracleDataAdapter
Dim dt As New Data.DataTable("DenseReport")
OracleSelectCommand1 = New System.Data.OracleClient.OracleCommand
OracleConnection1 = New System.Data.OracleClient.OracleConnection
OracleDataAdapter1 = New System.Data.OracleClient.OracleDataAdapter
OracleSelectCommand1.CommandText = "SELECT DRE_YEAR FROM DENSEREPORT
WHERE DRE_YEAR = '2001'"
OracleConnection1.ConnectionString = "user id=blah;data
source=blah;password=blah"
OracleSelectCommand1.Connection = OracleConnection1
OracleDataAdapter1.SelectCommand = OracleSelectCommand1
OracleDataAdapter1.Fill(dt)
Label1.Text = dt.Rows.Count.ToString
End Sub
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
The query above returns records. The following code does not, but it doesn't
cause an error.
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim OracleSelectCommand1 As System.Data.OracleClient.OracleCommand
Dim OracleConnection1 As System.Data.OracleClient.OracleConnection
Dim OracleDataAdapter1 As System.Data.OracleClient.OracleDataAdapter
Dim dt As New Data.DataTable("DenseReport")
OracleSelectCommand1 = New System.Data.OracleClient.OracleCommand
OracleConnection1 = New System.Data.OracleClient.OracleConnection
OracleDataAdapter1 = New System.Data.OracleClient.OracleDataAdapter
OracleSelectCommand1.CommandText = "SELECT DRE_YEAR FROM DENSEREPORT
WHERE DRE_YEAR = Year"
OracleSelectCommand1.Parameters.Add(New
System.Data.OracleClient.OracleParameter("pYear", "2001"))
OracleConnection1.ConnectionString = "user id=blah;data
source=blah;password=blah"
OracleSelectCommand1.Connection = OracleConnection1
OracleDataAdapter1.SelectCommand = OracleSelectCommand1
OracleDataAdapter1.Fill(dt)
Label1.Text = dt.Rows.Count.ToString
End Sub
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
Adding a : character before pYear in the OracleSelectCommand1.Parameters.Add
call makes no difference. I still get no records.
Can anyone tell me what's wrong? The database server is running Oracle 9i. I
have installed Oracle client 8.1.5 on my development machine.
Any help would be much appreciated.
Brian
I added the following code which compiles and executes correctly and returns
records:
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim OracleSelectCommand1 As System.Data.OracleClient.OracleCommand
Dim OracleConnection1 As System.Data.OracleClient.OracleConnection
Dim OracleDataAdapter1 As System.Data.OracleClient.OracleDataAdapter
Dim dt As New Data.DataTable("DenseReport")
OracleSelectCommand1 = New System.Data.OracleClient.OracleCommand
OracleConnection1 = New System.Data.OracleClient.OracleConnection
OracleDataAdapter1 = New System.Data.OracleClient.OracleDataAdapter
OracleSelectCommand1.CommandText = "SELECT DRE_YEAR FROM DENSEREPORT
WHERE DRE_YEAR = '2001'"
OracleConnection1.ConnectionString = "user id=blah;data
source=blah;password=blah"
OracleSelectCommand1.Connection = OracleConnection1
OracleDataAdapter1.SelectCommand = OracleSelectCommand1
OracleDataAdapter1.Fill(dt)
Label1.Text = dt.Rows.Count.ToString
End Sub
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
The query above returns records. The following code does not, but it doesn't
cause an error.
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim OracleSelectCommand1 As System.Data.OracleClient.OracleCommand
Dim OracleConnection1 As System.Data.OracleClient.OracleConnection
Dim OracleDataAdapter1 As System.Data.OracleClient.OracleDataAdapter
Dim dt As New Data.DataTable("DenseReport")
OracleSelectCommand1 = New System.Data.OracleClient.OracleCommand
OracleConnection1 = New System.Data.OracleClient.OracleConnection
OracleDataAdapter1 = New System.Data.OracleClient.OracleDataAdapter
OracleSelectCommand1.CommandText = "SELECT DRE_YEAR FROM DENSEREPORT
WHERE DRE_YEAR = Year"
OracleSelectCommand1.Parameters.Add(New
System.Data.OracleClient.OracleParameter("pYear", "2001"))
OracleConnection1.ConnectionString = "user id=blah;data
source=blah;password=blah"
OracleSelectCommand1.Connection = OracleConnection1
OracleDataAdapter1.SelectCommand = OracleSelectCommand1
OracleDataAdapter1.Fill(dt)
Label1.Text = dt.Rows.Count.ToString
End Sub
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
Adding a : character before pYear in the OracleSelectCommand1.Parameters.Add
call makes no difference. I still get no records.
Can anyone tell me what's wrong? The database server is running Oracle 9i. I
have installed Oracle client 8.1.5 on my development machine.
Any help would be much appreciated.
Brian