 |
| 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
|
|
|
|

January 16th, 2004, 05:48 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 16th, 2004, 06:16 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
:)
|
|

January 16th, 2004, 07:56 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
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.
|
|

January 21st, 2004, 12:54 AM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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>
|
|

January 21st, 2004, 12:55 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 21st, 2004, 01:05 AM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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>
|
|
|
 |