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 January 16th, 2004, 05:48 AM
Registered User
 
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default how can i get recordset by clicking a link

Hi,

I'm sending a value, in this case a feild value in a database like for
example 'Police'. I want to do this by pulling it out of a record and displaying
it as a hyperlink. This reference number field is of text type. so my code


I did that without any matter.

After that, once the user clicks the link that name has to go to same page but different frame and I want to assign it to a variable like this:

--------
Dim name
name=Request.QueryString("name")

I want to execute the SQL statement, which I define like this:

Rs.Open "SELECT distinct t.Internal_Emp_Name ,t.Extension, t.Resident_Tel_No ,o.Direct_Tel_No FROM TD_Internal_Emp t INNER JOIN TD_Catogary c ON t.Catogary_No = c.Catogary_No INNER JOIN TD_Office o ON c.Catogary_No = o.Catogary_No WHERE c.Category_Name=" & name& "';",conn


After the SQL is executed I want to display all of the fields related to
that specific record's name, like the name, tele no, etc, in a table



Please any help would be greatly appreciated,
Thank you...
Tilu
 
Old January 16th, 2004, 06:16 AM
Registered User
 
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

:)
 
Old January 16th, 2004, 07:56 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

1) Your query is missing a ' after c.Category_Name=
c.Category_Name='" & name& "';"

2) You should look into using a command object and a data reader. Recordsets are old style and are not as efficient as the new ADO.net data objects. There are several classes for different database connections (native MS-SQL, ODBC, OLEDB).

3) The easiest way to get data on the page in tabular format is to use a DataGrid. You can provide the datagrid a DataSource, and then DataBind() it and it will take care of everything. There are lots of datagrid examples online. There's actually a person who has a website dedicated to datagrids: DataGridGirl.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old January 21st, 2004, 12:54 AM
Authorized User
 
Join Date: Jan 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, there are a huge number of examples in the web, actually specking too many examples..;)

and you refer the Datagrid help on the help too, since the control is having soo many helpful, carefully designed methods and properties, you can complete you task vary quickly and easyly..

I'll will paste a very basic Datagrid code, but you cannot paste it and expect to run (little busy, else i'll help you..), just to get a very very basic idea...

<asp:datagrid id="dgList" runat="server" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" BackColor="White" CellPadding="3" GridLines="Horizontal" AutoGenerateColumns="False" Width="100%" AllowCustomPaging="false">

<Columns>
<asp:BoundColumn Visible=False DataField="RCCLevel" SortExpression="RCCLevel" HeaderText="Level"></asp:BoundColumn>
<asp:HyperLinkColumn DataNavigateUrlField="RCCPath" DataNavigateUrlFormatString="RepCtlCodeEdit.aspx?C ode={0}" DataTextField="RCCCode" HeaderText="Code"></asp:HyperLinkColumn>
<asp:BoundColumn DataField="RCCDesc" SortExpression="RCCDesc" HeaderText="Description"></asp:BoundColumn>
</Columns>
</asp:datagrid>



 
Old January 21st, 2004, 12:55 AM
Registered User
 
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by planoie
 1) Your query is missing a ' after c.Category_Name=
c.Category_Name='" & name& "';"

2) You should look into using a command object and a data reader. Recordsets are old style and are not as efficient as the new ADO.net data objects. There are several classes for different database connections (native MS-SQL, ODBC, OLEDB).

3) The easiest way to get data on the page in tabular format is to use a DataGrid. You can provide the datagrid a DataSource, and then DataBind() it and it will take care of everything. There are lots of datagrid examples online. There's actually a person who has a website dedicated to datagrids: DataGridGirl.

Peter
------------------------------------------------------
Work smarter, not harder.

Thank you very much

 
Old January 21st, 2004, 01:05 AM
Registered User
 
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by ManoYaka
 Yes, there are a huge number of examples in the web, actually specking too many examples..;)

and you refer the Datagrid help on the help too, since the control is having soo many helpful, carefully designed methods and properties, you can complete you task vary quickly and easyly..

I'll will paste a very basic Datagrid code, but you cannot paste it and expect to run (little busy, else i'll help you..), just to get a very very basic idea...



Hi ,
Thanks for ur idea.But I want to know how to play with querystring statement.If u know please reply me.














<asp:datagrid id="dgList" runat="server" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" BackColor="White" CellPadding="3" GridLines="Horizontal" AutoGenerateColumns="False" Width="100%" AllowCustomPaging="false">

<Columns>
<asp:BoundColumn Visible=False DataField="RCCLevel" SortExpression="RCCLevel" HeaderText="Level"></asp:BoundColumn>
<asp:HyperLinkColumn DataNavigateUrlField="RCCPath" DataNavigateUrlFormatString="RepCtlCodeEdit.aspx?C ode={0}" DataTextField="RCCCode" HeaderText="Code"></asp:HyperLinkColumn>
<asp:BoundColumn DataField="RCCDesc" SortExpression="RCCDesc" HeaderText="Description"></asp:BoundColumn>
</Columns>
</asp:datagrid>








Similar Threads
Thread Thread Starter Forum Replies Last Post
Get coordinates from clicking in a area eresina HTML Code Clinic 3 July 11th, 2005 11:25 AM
how can i delete records by clicking a link umair_rathore Classic ASP Databases 2 March 15th, 2005 08:46 AM
Clicking on a datagrid header badgolfer ASP.NET 1.0 and 1.1 Basics 1 November 5th, 2004 03:42 PM
Clicking on a row in a datagrid SaharaWizard VB Databases Basics 0 September 1st, 2004 04:25 PM
Disabling Right-Clicking in Reports SerranoG Access 1 July 24th, 2003 03:13 PM





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