Hi There,
I am trying to get the selected value of a listbox when I click a button,
everything works ok and I can bind the list and when I have a basic page and
click a button to invoke a sub it works fine, but when I try to place it in
the sub I want to use it give me an eror saying that the "Object reference
not set to an instance of an object." I can't understand why it works in a
small sub in the same class but then when I try to use it in another sub it
falls over!
Joey
--- code in page
<script language="vb" runat="server">
Sub Page_Load(byVal obj As Object, byVal e As EventArgs)
If Not Page.IsPostBack Then
lst.DataSource = CommonFunctions.BindStates
lst.DataValueField = "LocationID"
lst.DataTextField = "Location"
lst.Items.Insert(0, new ListItem("By State","0"))
lst.SelectedIndex = 0
lst.DataBind()
End If
End Sub
</script>
<asp:listbox id="lst" runat="server" Rows="1" AutoPostBack="false"
DataTextField="Location" DataValueField="LocationID"/>
<asp:TextBox id="txtlocationselection" width="250" maxlength= "250"
runat="server" />
<asp:button id="btnSubmit1" text="place listing" onClick="but_Click"
runat="server" />
</form>
---code behind sub
Sub Insertlisting_Click(Sender As Object, E As EventArgs)
--!suspectcode here
Dim curItem As String = lstS.SelectedItem.Value
'strlstRegion = trim(lstS.SelectedItem.Value.ToString())
'response.write (strlstRegion)
strManufacturer = txtManufacturer.text
strModelDescription = txtModelDescription.text
strModelDescription1 = txtModelDescription1.text
strtxtComments = txtComments.text
ccurtxtPrice = txtPrice.text
strtxt1 = txt1.text
strtxt2 = txt2.text
strtxt3 = txt3.text
If chk1.checked = true then
strChk1 = CHECKED
Else
strChk1 = NOTCHECKED
end if
If chk2.checked = true then
strChk2 = CHECKED
Else
strChk2 = NOTCHECKED
end if
If chk3.checked = true then
strChk3 = CHECKED
Else
strChk3 = NOTCHECKED
end if
If chk4.checked = true then
strChk4 = CHECKED
Else
strChk4 = NOTCHECKED
end if
If chk5.checked = true then
strChk5 = CHECKED
Else
strChk5 = NOTCHECKED
end if
If chk6.checked = true then
strChk6 = CHECKED
Else
strChk6 = NOTCHECKED
end if
If chk7.checked = true then
strChk7 = CHECKED
Else
strChk7 = NOTCHECKED
end if
If chk8.checked = true then
strChk8 = CHECKED
Else
strChk8 = NOTCHECKED
end if
If chk9.checked = true then
strChk9 = CHECKED
Else
strChk9 = NOTCHECKED
end if
If chk10.checked = true then
strChk10 = CHECKED
Else
strChk10 = NOTCHECKED
end if
'to do
'validate numeric fields
'change the size of the fields depending on input size
Dim myConnection as New
SqlConnection(ConfigurationSettings.AppSettings("c onnectionString"))
Try
myConnection.Open()
Dim myCommand As New SqlCommand("ListingAddControlValves", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
'name
Dim pFormname As New SqlParameter("@formname", SqlDbType.Nchar, 200)
pFormname.Value = "Control Valves"
myCommand.Parameters.Add(pFormname)
'formid
Dim pFormid As New SqlParameter("@formid", SqlDbType.int)
pFormid.Value = "6"
myCommand.Parameters.Add(pFormid)
'directive
myCommand.Parameters.Add("@directive", SqlDbType.Nchar, 5).Value = "I"
'current
myCommand.Parameters.Add("@currentlisting", SqlDbType.int).Value = 0
'txtmanufacturer
Dim pManufacturer As New SqlParameter("@manufacturer", SqlDbType.Nchar, 200)
pManufacturer.Value = strManufacturer
myCommand.Parameters.Add(pManufacturer)
'model
Dim modeldesc As New SqlParameter("@model", SqlDbType.Nchar, 300)
modeldesc.Value = strModelDescription
myCommand.Parameters.Add(modeldesc)
'desc
Dim desc As New SqlParameter("@description", SqlDbType.Varchar, 1000)
desc.Value = strModelDescription1
myCommand.Parameters.Add(desc)
'Nominal
Dim ptxt1 As New SqlParameter("@frm1value", SqlDbType.char, 20)
ptxt1.Value = strtxt1
myCommand.Parameters.Add(ptxt1)
'Pressure Sustaining
Dim pchk1 As New SqlParameter("@frm2value", SqlDbType.char, 10)
pchk1.Value = strChk1
myCommand.Parameters.Add(pchk1)
'Pressure Reducing
Dim pchk2 As New SqlParameter("@frm3value", SqlDbType.char, 10)
pchk2.Value = strChk2
myCommand.Parameters.Add(pchk2)
'Presure Relief
Dim pchk3 As New SqlParameter("@frm4value", SqlDbType.char, 10)
pchk3.Value = strChk3
myCommand.Parameters.Add(pchk3)
'Serge Anticipation
Dim pchk4 As New SqlParameter("@frm5value", SqlDbType.char, 10)
pchk4.Value = strChk4
myCommand.Parameters.Add(pchk4)
'Electronic Control Valves
Dim pchk5 As New SqlParameter("@frm6value", SqlDbType.char, 10)
pchk5.Value = strChk5
myCommand.Parameters.Add(pchk5)
'Air Release
Dim pchk6 As New SqlParameter("@frm7value", SqlDbType.char, 10)
pchk6.Value = strChk6
myCommand.Parameters.Add(pchk6)
'Water Meters
Dim pchk7 As New SqlParameter("@frm8value", SqlDbType.char, 10)
pchk7.Value = strChk7
myCommand.Parameters.Add(pchk7)
'other
Dim ptxt2 As New SqlParameter("@frm9value", SqlDbType.char, 20)
ptxt2.Value = strtxt2
myCommand.Parameters.Add(ptxt2)
'Bronze
Dim pchk8 As New SqlParameter("@frm10value", SqlDbType.char, 10)
pchk8.Value = strChk8
myCommand.Parameters.Add(pchk8)
'Cast Iron
Dim pchk9 As New SqlParameter("@frm11value", SqlDbType.char, 10)
pchk9.Value = strChk9
myCommand.Parameters.Add(pchk9)
'plastic
Dim pchk10 As New SqlParameter("@frm12value", SqlDbType.char, 10)
pchk10.Value = strChk10
myCommand.Parameters.Add(pchk10)
'quantity
Dim ptxt3 As New SqlParameter("@quantity", SqlDbType.Int, 4)
ptxt3.Value = strtxt3
myCommand.Parameters.Add(ptxt3)
'comments
Dim ptxtcomments As New SqlParameter("@comments", SqlDbType.Nchar, 200)
ptxtcomments.Value = strtxtComments
myCommand.Parameters.Add(ptxtcomments)
'listing price
Dim pccurtxtPrice As New SqlParameter("@listprice", SqlDbType.Money, 4)
pccurtxtPrice.Value = ccurtxtPrice
myCommand.Parameters.Add(pccurtxtPrice)
'location
Dim pstrlstRegion As New SqlParameter("@location", SqlDbType.Int,4)
pstrlstRegion.Value = curItem
myCommand.Parameters.Add(pstrlstRegion)
'userid
Dim puserid As New SqlParameter("@userid", SqlDbType.Int,4)
puserid.Value = Session("MemberID")
myCommand.Parameters.Add(puserid)
Dim pUsername As New SqlParameter("@Username", SqlDbType.Nchar, 200)
pUsername.Value = Session("UserName")
myCommand.Parameters.Add(pUsername)
myCommand.Parameters.Add("@status", SqlDbType.char, 50).Value = "Pending
Payment"
myCommand.Parameters.Add(New SqlParameter("@listingID", SqlDbType.Int))
myCommand.Parameters("@listingID").Direction() = ParameterDirection.Output
myCommand.ExecuteReader()
dim inlast as Integer
inlast = myCommand.Parameters("@listingID").value
response.redirect("uploadimage.aspx?id=" & Server.UrlEncode(inlast)&"&D="&
Server.UrlEncode("3"))
Catch ex as InvalidCastException
Status.Text = ex.ToString()
Catch ex As SqlException
Status.Text = "Database error: " & ex.message
Catch ex As Exception
Status.Text = "General error: " & ex.message
End Try
'End If
End Sub 2 3149
"Object reference not set to an instance of an object" is one of the easiest
exceptions to track down, esp. if you know what line of code the exception
was thrown at. It means that the code is referencing an object that doesn't
exist (not initialized, removed, etc). All you have to do is identify the
object references in the statement, and figure out which one doesn't exist.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Joey" <jo**********@digital.com> wrote in message
news:#d**************@tk2msftngp13.phx.gbl... Hi There,
I am trying to get the selected value of a listbox when I click a button, everything works ok and I can bind the list and when I have a basic page
and click a button to invoke a sub it works fine, but when I try to place it
in the sub I want to use it give me an eror saying that the "Object reference not set to an instance of an object." I can't understand why it works in a small sub in the same class but then when I try to use it in another sub
it falls over! Joey --- code in page
<script language="vb" runat="server"> Sub Page_Load(byVal obj As Object, byVal e As EventArgs) If Not Page.IsPostBack Then lst.DataSource = CommonFunctions.BindStates lst.DataValueField = "LocationID" lst.DataTextField = "Location" lst.Items.Insert(0, new ListItem("By State","0")) lst.SelectedIndex = 0 lst.DataBind() End If End Sub </script>
<asp:listbox id="lst" runat="server" Rows="1" AutoPostBack="false" DataTextField="Location" DataValueField="LocationID"/>
<asp:TextBox id="txtlocationselection" width="250" maxlength= "250" runat="server" />
<asp:button id="btnSubmit1" text="place listing" onClick="but_Click" runat="server" /> </form>
---code behind sub
Sub Insertlisting_Click(Sender As Object, E As EventArgs)
--!suspectcode here
Dim curItem As String = lstS.SelectedItem.Value
'strlstRegion = trim(lstS.SelectedItem.Value.ToString())
'response.write (strlstRegion) strManufacturer = txtManufacturer.text
strModelDescription = txtModelDescription.text
strModelDescription1 = txtModelDescription1.text
strtxtComments = txtComments.text
ccurtxtPrice = txtPrice.text
strtxt1 = txt1.text
strtxt2 = txt2.text
strtxt3 = txt3.text If chk1.checked = true then
strChk1 = CHECKED
Else
strChk1 = NOTCHECKED
end if
If chk2.checked = true then
strChk2 = CHECKED
Else
strChk2 = NOTCHECKED
end if
If chk3.checked = true then
strChk3 = CHECKED
Else
strChk3 = NOTCHECKED
end if
If chk4.checked = true then
strChk4 = CHECKED
Else
strChk4 = NOTCHECKED
end if
If chk5.checked = true then
strChk5 = CHECKED
Else
strChk5 = NOTCHECKED
end if
If chk6.checked = true then
strChk6 = CHECKED
Else
strChk6 = NOTCHECKED
end if
If chk7.checked = true then
strChk7 = CHECKED
Else
strChk7 = NOTCHECKED
end if
If chk8.checked = true then
strChk8 = CHECKED
Else
strChk8 = NOTCHECKED
end if
If chk9.checked = true then
strChk9 = CHECKED
Else
strChk9 = NOTCHECKED
end if
If chk10.checked = true then
strChk10 = CHECKED
Else
strChk10 = NOTCHECKED
end if
'to do
'validate numeric fields
'change the size of the fields depending on input size
Dim myConnection as New SqlConnection(ConfigurationSettings.AppSettings("c onnectionString"))
Try
myConnection.Open()
Dim myCommand As New SqlCommand("ListingAddControlValves", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
'name
Dim pFormname As New SqlParameter("@formname", SqlDbType.Nchar, 200)
pFormname.Value = "Control Valves"
myCommand.Parameters.Add(pFormname)
'formid
Dim pFormid As New SqlParameter("@formid", SqlDbType.int)
pFormid.Value = "6"
myCommand.Parameters.Add(pFormid)
'directive
myCommand.Parameters.Add("@directive", SqlDbType.Nchar, 5).Value = "I"
'current
myCommand.Parameters.Add("@currentlisting", SqlDbType.int).Value = 0
'txtmanufacturer
Dim pManufacturer As New SqlParameter("@manufacturer", SqlDbType.Nchar,
200) pManufacturer.Value = strManufacturer
myCommand.Parameters.Add(pManufacturer)
'model
Dim modeldesc As New SqlParameter("@model", SqlDbType.Nchar, 300)
modeldesc.Value = strModelDescription
myCommand.Parameters.Add(modeldesc)
'desc
Dim desc As New SqlParameter("@description", SqlDbType.Varchar, 1000)
desc.Value = strModelDescription1
myCommand.Parameters.Add(desc)
'Nominal
Dim ptxt1 As New SqlParameter("@frm1value", SqlDbType.char, 20)
ptxt1.Value = strtxt1
myCommand.Parameters.Add(ptxt1)
'Pressure Sustaining
Dim pchk1 As New SqlParameter("@frm2value", SqlDbType.char, 10)
pchk1.Value = strChk1
myCommand.Parameters.Add(pchk1)
'Pressure Reducing
Dim pchk2 As New SqlParameter("@frm3value", SqlDbType.char, 10)
pchk2.Value = strChk2
myCommand.Parameters.Add(pchk2)
'Presure Relief
Dim pchk3 As New SqlParameter("@frm4value", SqlDbType.char, 10)
pchk3.Value = strChk3
myCommand.Parameters.Add(pchk3)
'Serge Anticipation
Dim pchk4 As New SqlParameter("@frm5value", SqlDbType.char, 10)
pchk4.Value = strChk4
myCommand.Parameters.Add(pchk4)
'Electronic Control Valves
Dim pchk5 As New SqlParameter("@frm6value", SqlDbType.char, 10)
pchk5.Value = strChk5
myCommand.Parameters.Add(pchk5)
'Air Release
Dim pchk6 As New SqlParameter("@frm7value", SqlDbType.char, 10)
pchk6.Value = strChk6
myCommand.Parameters.Add(pchk6)
'Water Meters
Dim pchk7 As New SqlParameter("@frm8value", SqlDbType.char, 10)
pchk7.Value = strChk7
myCommand.Parameters.Add(pchk7)
'other
Dim ptxt2 As New SqlParameter("@frm9value", SqlDbType.char, 20)
ptxt2.Value = strtxt2
myCommand.Parameters.Add(ptxt2)
'Bronze
Dim pchk8 As New SqlParameter("@frm10value", SqlDbType.char, 10)
pchk8.Value = strChk8
myCommand.Parameters.Add(pchk8)
'Cast Iron
Dim pchk9 As New SqlParameter("@frm11value", SqlDbType.char, 10)
pchk9.Value = strChk9
myCommand.Parameters.Add(pchk9)
'plastic
Dim pchk10 As New SqlParameter("@frm12value", SqlDbType.char, 10)
pchk10.Value = strChk10
myCommand.Parameters.Add(pchk10)
'quantity
Dim ptxt3 As New SqlParameter("@quantity", SqlDbType.Int, 4)
ptxt3.Value = strtxt3
myCommand.Parameters.Add(ptxt3)
'comments
Dim ptxtcomments As New SqlParameter("@comments", SqlDbType.Nchar, 200)
ptxtcomments.Value = strtxtComments
myCommand.Parameters.Add(ptxtcomments)
'listing price
Dim pccurtxtPrice As New SqlParameter("@listprice", SqlDbType.Money, 4)
pccurtxtPrice.Value = ccurtxtPrice
myCommand.Parameters.Add(pccurtxtPrice)
'location
Dim pstrlstRegion As New SqlParameter("@location", SqlDbType.Int,4)
pstrlstRegion.Value = curItem
myCommand.Parameters.Add(pstrlstRegion)
'userid
Dim puserid As New SqlParameter("@userid", SqlDbType.Int,4)
puserid.Value = Session("MemberID")
myCommand.Parameters.Add(puserid)
Dim pUsername As New SqlParameter("@Username", SqlDbType.Nchar, 200)
pUsername.Value = Session("UserName")
myCommand.Parameters.Add(pUsername)
myCommand.Parameters.Add("@status", SqlDbType.char, 50).Value = "Pending Payment"
myCommand.Parameters.Add(New SqlParameter("@listingID", SqlDbType.Int))
myCommand.Parameters("@listingID").Direction() = ParameterDirection.Output myCommand.ExecuteReader()
dim inlast as Integer
inlast = myCommand.Parameters("@listingID").value
response.redirect("uploadimage.aspx?id=" & Server.UrlEncode(inlast)&"&D="& Server.UrlEncode("3"))
Catch ex as InvalidCastException
Status.Text = ex.ToString()
Catch ex As SqlException
Status.Text = "Database error: " & ex.message
Catch ex As Exception
Status.Text = "General error: " & ex.message
End Try
'End If
End Sub
Hi Kevin,
I do know the line where the error is happening "> > Dim curItem As String =
lstS.SelectedItem.Value" the thing is if I create a small button_click()
function and then run the same code in the same class using the same control
it works, but if I try to use the function that I'm using it falls over and
I just can't work out why?
Any other ideas ?
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:u2*************@TK2MSFTNGP09.phx.gbl... "Object reference not set to an instance of an object" is one of the
easiest exceptions to track down, esp. if you know what line of code the exception was thrown at. It means that the code is referencing an object that
doesn't exist (not initialized, removed, etc). All you have to do is identify the object references in the statement, and figure out which one doesn't
exist. -- HTH, Kevin Spencer .Net Developer Microsoft MVP Big things are made up of lots of little things.
"Joey" <jo**********@digital.com> wrote in message news:#d**************@tk2msftngp13.phx.gbl... Hi There,
I am trying to get the selected value of a listbox when I click a
button, everything works ok and I can bind the list and when I have a basic page and click a button to invoke a sub it works fine, but when I try to place it in the sub I want to use it give me an eror saying that the "Object
reference not set to an instance of an object." I can't understand why it works in
a small sub in the same class but then when I try to use it in another sub it falls over! Joey --- code in page
<script language="vb" runat="server"> Sub Page_Load(byVal obj As Object, byVal e As EventArgs) If Not Page.IsPostBack Then lst.DataSource = CommonFunctions.BindStates lst.DataValueField = "LocationID" lst.DataTextField = "Location" lst.Items.Insert(0, new ListItem("By State","0")) lst.SelectedIndex = 0 lst.DataBind() End If End Sub </script>
<asp:listbox id="lst" runat="server" Rows="1" AutoPostBack="false" DataTextField="Location" DataValueField="LocationID"/>
<asp:TextBox id="txtlocationselection" width="250" maxlength= "250" runat="server" />
<asp:button id="btnSubmit1" text="place listing" onClick="but_Click" runat="server" /> </form>
---code behind sub
Sub Insertlisting_Click(Sender As Object, E As EventArgs)
--!suspectcode here
Dim curItem As String = lstS.SelectedItem.Value
'strlstRegion = trim(lstS.SelectedItem.Value.ToString())
'response.write (strlstRegion) strManufacturer = txtManufacturer.text
strModelDescription = txtModelDescription.text
strModelDescription1 = txtModelDescription1.text
strtxtComments = txtComments.text
ccurtxtPrice = txtPrice.text
strtxt1 = txt1.text
strtxt2 = txt2.text
strtxt3 = txt3.text If chk1.checked = true then
strChk1 = CHECKED
Else
strChk1 = NOTCHECKED
end if
If chk2.checked = true then
strChk2 = CHECKED
Else
strChk2 = NOTCHECKED
end if
If chk3.checked = true then
strChk3 = CHECKED
Else
strChk3 = NOTCHECKED
end if
If chk4.checked = true then
strChk4 = CHECKED
Else
strChk4 = NOTCHECKED
end if
If chk5.checked = true then
strChk5 = CHECKED
Else
strChk5 = NOTCHECKED
end if
If chk6.checked = true then
strChk6 = CHECKED
Else
strChk6 = NOTCHECKED
end if
If chk7.checked = true then
strChk7 = CHECKED
Else
strChk7 = NOTCHECKED
end if
If chk8.checked = true then
strChk8 = CHECKED
Else
strChk8 = NOTCHECKED
end if
If chk9.checked = true then
strChk9 = CHECKED
Else
strChk9 = NOTCHECKED
end if
If chk10.checked = true then
strChk10 = CHECKED
Else
strChk10 = NOTCHECKED
end if
'to do
'validate numeric fields
'change the size of the fields depending on input size
Dim myConnection as New SqlConnection(ConfigurationSettings.AppSettings("c onnectionString"))
Try
myConnection.Open()
Dim myCommand As New SqlCommand("ListingAddControlValves", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
'name
Dim pFormname As New SqlParameter("@formname", SqlDbType.Nchar, 200)
pFormname.Value = "Control Valves"
myCommand.Parameters.Add(pFormname)
'formid
Dim pFormid As New SqlParameter("@formid", SqlDbType.int)
pFormid.Value = "6"
myCommand.Parameters.Add(pFormid)
'directive
myCommand.Parameters.Add("@directive", SqlDbType.Nchar, 5).Value = "I"
'current
myCommand.Parameters.Add("@currentlisting", SqlDbType.int).Value = 0
'txtmanufacturer
Dim pManufacturer As New SqlParameter("@manufacturer", SqlDbType.Nchar, 200) pManufacturer.Value = strManufacturer
myCommand.Parameters.Add(pManufacturer)
'model
Dim modeldesc As New SqlParameter("@model", SqlDbType.Nchar, 300)
modeldesc.Value = strModelDescription
myCommand.Parameters.Add(modeldesc)
'desc
Dim desc As New SqlParameter("@description", SqlDbType.Varchar, 1000)
desc.Value = strModelDescription1
myCommand.Parameters.Add(desc)
'Nominal
Dim ptxt1 As New SqlParameter("@frm1value", SqlDbType.char, 20)
ptxt1.Value = strtxt1
myCommand.Parameters.Add(ptxt1)
'Pressure Sustaining
Dim pchk1 As New SqlParameter("@frm2value", SqlDbType.char, 10)
pchk1.Value = strChk1
myCommand.Parameters.Add(pchk1)
'Pressure Reducing
Dim pchk2 As New SqlParameter("@frm3value", SqlDbType.char, 10)
pchk2.Value = strChk2
myCommand.Parameters.Add(pchk2)
'Presure Relief
Dim pchk3 As New SqlParameter("@frm4value", SqlDbType.char, 10)
pchk3.Value = strChk3
myCommand.Parameters.Add(pchk3)
'Serge Anticipation
Dim pchk4 As New SqlParameter("@frm5value", SqlDbType.char, 10)
pchk4.Value = strChk4
myCommand.Parameters.Add(pchk4)
'Electronic Control Valves
Dim pchk5 As New SqlParameter("@frm6value", SqlDbType.char, 10)
pchk5.Value = strChk5
myCommand.Parameters.Add(pchk5)
'Air Release
Dim pchk6 As New SqlParameter("@frm7value", SqlDbType.char, 10)
pchk6.Value = strChk6
myCommand.Parameters.Add(pchk6)
'Water Meters
Dim pchk7 As New SqlParameter("@frm8value", SqlDbType.char, 10)
pchk7.Value = strChk7
myCommand.Parameters.Add(pchk7)
'other
Dim ptxt2 As New SqlParameter("@frm9value", SqlDbType.char, 20)
ptxt2.Value = strtxt2
myCommand.Parameters.Add(ptxt2)
'Bronze
Dim pchk8 As New SqlParameter("@frm10value", SqlDbType.char, 10)
pchk8.Value = strChk8
myCommand.Parameters.Add(pchk8)
'Cast Iron
Dim pchk9 As New SqlParameter("@frm11value", SqlDbType.char, 10)
pchk9.Value = strChk9
myCommand.Parameters.Add(pchk9)
'plastic
Dim pchk10 As New SqlParameter("@frm12value", SqlDbType.char, 10)
pchk10.Value = strChk10
myCommand.Parameters.Add(pchk10)
'quantity
Dim ptxt3 As New SqlParameter("@quantity", SqlDbType.Int, 4)
ptxt3.Value = strtxt3
myCommand.Parameters.Add(ptxt3)
'comments
Dim ptxtcomments As New SqlParameter("@comments", SqlDbType.Nchar, 200)
ptxtcomments.Value = strtxtComments
myCommand.Parameters.Add(ptxtcomments)
'listing price
Dim pccurtxtPrice As New SqlParameter("@listprice", SqlDbType.Money, 4)
pccurtxtPrice.Value = ccurtxtPrice
myCommand.Parameters.Add(pccurtxtPrice)
'location
Dim pstrlstRegion As New SqlParameter("@location", SqlDbType.Int,4)
pstrlstRegion.Value = curItem
myCommand.Parameters.Add(pstrlstRegion)
'userid
Dim puserid As New SqlParameter("@userid", SqlDbType.Int,4)
puserid.Value = Session("MemberID")
myCommand.Parameters.Add(puserid)
Dim pUsername As New SqlParameter("@Username", SqlDbType.Nchar, 200)
pUsername.Value = Session("UserName")
myCommand.Parameters.Add(pUsername)
myCommand.Parameters.Add("@status", SqlDbType.char, 50).Value = "Pending Payment"
myCommand.Parameters.Add(New SqlParameter("@listingID", SqlDbType.Int))
myCommand.Parameters("@listingID").Direction() =
ParameterDirection.Output
myCommand.ExecuteReader()
dim inlast as Integer
inlast = myCommand.Parameters("@listingID").value
response.redirect("uploadimage.aspx?id=" &
Server.UrlEncode(inlast)&"&D="& Server.UrlEncode("3"))
Catch ex as InvalidCastException
Status.Text = ex.ToString()
Catch ex As SqlException
Status.Text = "Database error: " & ex.message
Catch ex As Exception
Status.Text = "General error: " & ex.message
End Try
'End If
End Sub
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tom Asken |
last post by:
Short version: IE 6.0 wrongly posts <button ..> value. Internet
Explorer should only post the value of the clicked submit button - but
IE 6 posts the value of several submit buttons if they have...
|
by: RandyS |
last post by:
I know how to do it in VB6, but that doesn't work in .NET. I am trying to
select single or multiple items to load into a collection.
--
..NET Developer in Training
|
by: Mark Donners |
last post by:
I have access 2002 database
I like to fill a record field in a table with a text when i click a button
I have two tables say table1 and table2.
I have a form based on table1, it has a subform...
|
by: jeff |
last post by:
is there a way to display an hourglass for the client's cursor when clicking
a button running server-side code?
thanks.
|
by: Dale Levesque |
last post by:
I get this message. any ideas??
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************...
|
by: chris.dannemiller |
last post by:
The list box control allows the user to click the mouse down and scroll
the control up and down if the user bring the mouse past the extents of
the control. How can this be replicated in a custom...
|
by: SBK |
last post by:
Hi All,
Got a quick problem, hoping someone can help me out here.
Using an Upload Control. If a file to upload is specified and another form
action is committed (i.e. btnBack) then the upload...
|
by: pechar |
last post by:
Hi all,
I created a test web application in asp.net. It works like a dream in IE but when it gets to Firefox I get an exception as follows
...
|
by: PHPstarter |
last post by:
As the title says, how would one go by doing this?
One button, one main image.
Click the button and the image will change into another specified.
And there could be more than just 2 images...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |