|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Passing a Parameter
VB.net Newbie:
I am simply trying to pass a variable from one aspx page to another. The variable - RW is set equal to a pointer in a database. Once I pass the ID from one aspx page to another, I want to use the ID (which is an autonumber database field) to lookup the correct row in the database again, and then I want to fill up textboxes with the corresponding data....txtTitle = title; txtStreet = street, etc. So here is what is happening: ASPX code for sending the string and calling the new page: Dim SID As Integer SID = DataGrid1.DataKeys(DataGrid1.SelectedIndex) Response.Redirect("propdetailbe.aspx?RW=" & SID) ASPX receiving RW: Me.OleDbConnection1.Open() Dim RW As Integer Dim cmd As New OleDbCommand cmd.Connection = Me.OleDbConnection1() cmd.CommandText = "SELECT * FROM FeListings2 Where ID=" & RW Dim Ole As New OleDbDataAdapter Dim OCB As New OleDb.OleDbCommandBuilder(Ole) Dim DS As New DataSet Ole.SelectCommand = cmd Ole.Fill(DS, "Felistings2") Dim objRow As DataRow objRow = DS.Tables("Felistings2").Rows.Item(RW) txtTitle.Text = objRow.Item("Title") During troubleshooting, etc. I have observed the following: objRow=DS.Tables("name of database").Rows.Item(RW)...where RW is a passed integer. a) With .Item(RW) ....gives an error of input mismatch b)with .Item("RW").....gives an error of No row at position 0. c) When I look at debug near the select statement, RW=nothing. d)When I do Request.Querystring("RW") it yields "X" where X is the correct ID. e) When I change the select statement to ....where ID=" & 4....it will find the record 4. So why does RW appear to have a value of "X" but yet pass nothing. Are my naming conventions incorrect? Any help would be appreciated. Thanks. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > Passing a Parameter |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|