473,386 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

c# help for my asp.net page

Hi

I am freelancer and designing a .net page.

I require the syntax in C# for capturing the variable from carryover
line in url eg: www.xyz.com/ccc.aspx?mid=12

how to capture this mid in c# and I have to use in my sql string along
with Select * from Tbname where mid = 12.

can yu pls help me with the syntax of this problem

Nov 8 '06 #1
5 1039
Hello, g_******@yahoo.com!

the text after '?' is referred to as querystring.
In asp.net page to access query string you can use HttpRequest class.
The code can be like this

//Page_Load

string var = this.Request.QueryString["mid"];
int midVal;
if ( var != null && vat.Length 0 )
{
if (!int.TryParse(var, out midVal) )
{
//report error
}
}

gI am freelancer and designing a .net page.

gI require the syntax in C# for capturing the variable from carryover
gline in url eg: www.xyz.com/ccc.aspx?mid=12

ghow to capture this mid in c# and I have to use in my sql string
galong
gwith Select * from Tbname where mid = 12.

gcan yu pls help me with the syntax of this problem


--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Nov 8 '06 #2
As you say you are a freelancer, I will assume you have at least some
programming background. As such, the best thing would really be to look at
the numerous aspnet examples on MSDN or google...

How about: http://aspnet101.com/aspnet101/tutorials.aspx?id=29 titled
""Using Querystrings From Page to Page Then using them in your SQL
statement". I haven't read it, but it sounds promising...

Marc
Nov 8 '06 #3
And yes the language is VB, but the C# / VB conversion should not be an
issue.

Marc
Nov 8 '06 #4
Hi vadym
Thanks for all info, however here is my code ::::

string var = this.Request.QueryString["midcateid"];
// replace the database connection information here with
your own login information
SqlConnection conn = new
SqlConnection(System.Configuration.ConfigurationSe ttings.AppSettings["ConnectionInfo"]);
SqlCommand comm = new SqlCommand("SELECT DISTINCT hdetails
FROM Hofftable",conn);
SqlDataReader dr;

I have used the query string to bring the record autoid from prev page
and it is a numeric value. so if I capture it as a string, wont id give
me a problem while adding in my SQL cmd ie..

SELECT DISTINCT hdetails FROM Hofftable Where adminlock = 1 AND autoid
=" + var,conn);

?????

pls help

regrds

Vadym Stetsyak wrote:
Hello, g_******@yahoo.com!

the text after '?' is referred to as querystring.
In asp.net page to access query string you can use HttpRequest class.
The code can be like this

//Page_Load

string var = this.Request.QueryString["mid"];
int midVal;
if ( var != null && vat.Length 0 )
{
if (!int.TryParse(var, out midVal) )
{
//report error
}
}

gI am freelancer and designing a .net page.

gI require the syntax in C# for capturing the variable from carryover
gline in url eg: www.xyz.com/ccc.aspx?mid=12

ghow to capture this mid in c# and I have to use in my sql string
galong
gwith Select * from Tbname where mid = 12.

gcan yu pls help me with the syntax of this problem
--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Nov 9 '06 #5
Thanks a lot my friend....I solved the problem on my end...
But another 1 has occurred....
This time I was trying to send the mail in MHML format with C# code
It is very easy in classic asp but what i find in .net(C#) it seems to
be a tedious one....
can yu help me with the code pls..

thanks

Nov 9 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michael Brennan-White | last post by:
If I submit my for using a get action the resulting page loads . If I use a post action I get an error page saying "The page cannot be found". I am calling the originating page!!! This happens...
0
by: Nathan | last post by:
Hi, I seem to having a peculiar problem with the display of odd and even pages in XSL-FO. Here is a small background of the problem. My xsl stylesheet mentions my fo:layout-master-set as ...
4
by: Kevin Phifer | last post by:
Ok, before anyone freaks out, I have a solution I need to create that gathers content from maybe different places. Each one can return a <form> in the html, so its the classic can't have more than...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
6
by: MooreSmnith | last post by:
When I navigate to the next page using Response.Rediect("MyNextPage.aspx") current page Page_Load event is called. What I may wrongly understood is that post back will happen whenever there is any...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
8
by: Ed Jay | last post by:
I want to use history.go() to navigate between my previously loaded pages. I'm looking for a way to trigger a function call when a page is accessed using history.go(). Is there an event generated?...
17
by: =?Utf-8?B?Y2F0aGFyaW51cyB2YW4gZGVyIHdlcmY=?= | last post by:
Hello, I have build a website with approximately 30 html-pages. When I search this website in Google, I see the index.html or home.html on this website, but also other html-pages on this...
3
by: Mesut | last post by:
I have written a form in with radio buttons the name is set to orderby and the value is set to KundeVorName and the next value is KundeNachName and it goes so on. I wanna modify my query according...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
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...
0
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...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.