Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 11th, 2006, 05:23 PM
Registered User
 
Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with view details based on querystring

Hello all,

I've created a datagrid with four columns which included the hyperlink column for viewing more details about the particular data. Click the hyperlink and it will show the details on the different or seperate page based on the querystring. The problem is, when I click the link, it won't load the particular data on the next page. It only load the header instead of the whole row of the particular data.

This is the code for the view details page.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim myConnection As MySqlConnection

Dim myCommand As MySqlDataAdapter

Dim strSQL As String

Dim mydataset As DataSet

strSQL = "SELECT speciesid, scientificname,commonname FROM species WHERE speciesid = @speciesid"

myConnection = New MySqlConnection("server=localhost; uid=root; password=kucemari; database=plantsnherbs")

myCommand = New MySqlDataAdapter(strSQL, myConnection)

myCommand.SelectCommand.Parameters.Add(New MySqlParameter("@speciesid", MySqlDbType.Int32))

myCommand.SelectCommand.Parameters("@speciesid").V alue = Request.QueryString("id")

mydataset = New DataSet

myCommand.Fill(mydataset, "species")

Dgspeciesview.DataSource = mydataset.Tables("species").DefaultView

Dgspeciesview.DataBind()

End Sub

Hope you guys can help this out. It doesn't says any error occured but this is not what I wanted. I'm using MySQL for the database and my asp.net is version 1.1.

Thanks

 
Old March 12th, 2006, 01:39 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Are you sure you are passing the ID? Also, make sure there is actually data for that ID.

Jim

 
Old March 12th, 2006, 02:33 AM
Registered User
 
Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes I'm sure. Because when I tested by putting the Response.Write (Request.QueryString("id")), the id is passed in the next page. Is it something wrong with the code?

 
Old March 12th, 2006, 02:35 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

test your query, make sure you have rows in the table based on that id

 
Old March 12th, 2006, 02:40 AM
Registered User
 
Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've tested the query and everything is ok but still it won't appear in the next page details. what should i do? is it something wrong with the code or something else?

 
Old March 12th, 2006, 02:44 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Try:
myCommand.SelectCommand.Parameters("@speciesid").V alue = CInt(Request.QueryString("id"))


 
Old March 12th, 2006, 02:49 AM
Registered User
 
Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have tried the code. Nothing happen. Still the same. Nothing appear in the datagrid.
Thanks for your quick reply jbenson001

 
Old March 12th, 2006, 02:55 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Why do you have these?

Dim myConnection As MySqlConnection

Dim myCommand As MySqlDataAdapter

then you just reacreate the objects later on? remove them

Then:

    myConnection = New sqlconnection("server=localhost; uid=root; password=kucemari; database=plantsnherbs")

        myCommand = New sqldataadapter(strSQL, myConnection)

also, trace through your code

Jim

 
Old March 12th, 2006, 03:49 AM
Registered User
 
Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When I removed the Dim myconnection and dim mycommand, replacing them with the codes that you gave, it keeps underlined the myCommand = New MySqlDataAdapter. Saying that overload resolution failed.


 
Old March 12th, 2006, 02:33 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Look up the syntax in vs help..






Similar Threads
Thread Thread Starter Forum Replies Last Post
regarding the dropdownlist in the details view gopalawaghate ASP.NET 1.0 and 1.1 Professional 1 September 26th, 2008 02:23 AM
view details radheshsharma1032 .NET Framework 2.0 0 January 12th, 2008 10:06 AM
populate details view or list view non empty rows iinfoque ASP.NET 2.0 Basics 0 March 11th, 2007 06:11 AM
Regarding Details View aekta ASP.NET 2.0 Professional 0 March 10th, 2007 11:46 PM
Details View without Datasource harshaghanta ASP.NET 2.0 Professional 0 November 20th, 2006 09:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.