I have no idea what went wrong. Kindly advise. Thank you!
=====================================================
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
getDetails()
End If
Dim confirmMsg As String
' On reolad
If Page.IsPostBack Then
' Set Message to Notify User
confirmMsg = "The event has been updated successfully."
'display msg
lblConfirm.Text = confirmMsg
End If
End Sub
Sub getDetails()
Dim sql1 As OleDbDataAdapter
Dim objCommand As OleDbCommand
Dim strSQLQuery As String
Dim oledbconnection1 As OleDbConnection
Dim passedID As String
passedID = Request.QueryString("EventID")
strSQLQuery = "SELECT * FROM Event WHERE EventID= '" & passedID & "'"
oledbconnection1 = New OleDbConnection(Application("connectionStr"))
objCommand = New OleDbCommand(strSQLQuery, oledbconnection1)
sql1 = New OleDbDataAdapter(objCommand)
Dim dset1 As New DataSet
sql1.Fill(dset1, "Event")
txtTitle.Text &= " " & dset1.Tables("Event").Rows(0).Item("EventTitle")
oledbconnection1.Open()
objCommand.ExecuteNonQuery()
oledbconnection1.Close()
End SubHi,
it would be nice if you also gave the relevant place where the error occured. But the times that I encountered this error message just ment exactly what it states: there is no row --> there are 0 rows returned by your query or the dataset didn't get filled.
Grz, Kris.
Debug getDetails...
-----------
Sub getDetails()
Dim sql1 As OleDbDataAdapter
Dim objCommand As OleDbCommand
Dim strSQLQuery As String
Dim oledbconnection1 As OleDbConnection
Debug your method...
Dim passedID As String
passedID = Request.QueryString("EventID")
'!!! Evaluate passedID. What does it contain? If its a valid value then continue !!!
strSQLQuery = "SELECT * FROM Event WHERE EventID= '" & passedID & "'"
'!!! Now evaluate strSqlQuery. What does it contain?? If valid continue !!!
oledbconnection1 = New OleDbConnection(Application("connectionStr"))
objCommand = New OleDbCommand(strSQLQuery, oledbconnection1)
sql1 = New OleDbDataAdapter(objCommand)
Dim dset1 As New DataSet
sql1.Fill(dset1, "Event")
txtTitle.Text &= " " & dset1.Tables("Event").Rows(0).Item("EventTitle")
End Sub
As long as it all passed ok. That should return a resultset.
Saying that I,ve not checked it syntax wise but its more fluid.
0 comments:
Post a Comment