Hi, I used to experiment with making websites with ASP and Dreamweaver back like 5 years ago. I am now developing a website with ASP.NET and Visual Studio 2008.

One thing I used to like about ASP and Dreamweaver (together) was that after a little bit of going through some learning (as I remember), I was quickly able to understand how to create a web page that would show me specific data from a specific user as a single record. Not all the records from a database field, but just the ONE and ONLY record that is associated with the specific user!

This was done by telling the server to only display database content from the userId that was included in the url of the page. For example, at a webpage location of http://localhost/mysite/mypage.asp?userId=423942. You guys know what I'm talking about, I'm sure.

Obviously this same method is still being used today with asp.net.

So, please let me know what am I supposed to do to make this same thing possible with asp.net?

I realized this is called a querystring. So yeah, the real question is, how do I get single records from databases based on a userid specified in the querystring?

sql query associated with the url
something like

select * from database where userid = $_get['userid'];

the exact syntax for the sql version on your host, probably mssql if an asp.net page is available online, as is the correct syntax to connect to the database & to embed the sql query in the asp page
don't know enough(any) asp to sample code it

YES ITS QUERYSTRING, The most common & easiest way of passing data is query string. Usually we pass value(s) through query string of the page and then this value is pulled from Request object in another page. One thing keep in mind that user can view query string value any time(from brwser address, View source, even on mouse over of a link etc.). So never pass information which is secure like password through query string. Query string appear after a question mark of a hyperlink & you can add more by adding & Like:

<a href='http://shawpnendu.blogspot.com?var1=10&var2=10'>......</a>

With ASP.NET, you have to use ADO.NET classes. At present I am not aware of the database you are using. Following example uses MS-ACCESS database.

protected void Page_Load(object s,EventArgs e) {
      string userid=Request["userid"];

      string sql="select * from tablename where userid='" + userid + "'";
   
       System.Data.OleDb.OleDbDataAdapter adp = new System.Data.OleDb.OleDbDataAdapter(sql, "Provider=Microsoft.jet.oledb.4.0;Data Source=c:\\aa\\db.mdb");
            System.Data.DataTable dt = new DataTable();
            adp.Fill(dt);
            string msg="";
            if (dt.Rows.Count == 0)
                msg = "No Record";
            else
                msg = "Value of 1st column : " + dt.Rows[0][0] + " Value of second column : " + dt.Rows[0][1];
   
   Response.Write(msg);
  }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.