Problem with getting data from the same col in an Access DB!

Results 1 to 5 of 5

Thread: Problem with getting data from the same col in an Access DB!

  1. #1
    Martin, Sweden Guest

    Default Problem with getting data from the same col in an Access DB!

    Hey dudes!<BR>I have a slight problem, please help me out!<BR><BR>I have a table in an access db, one of the rows in the table contains the customers id!<BR><BR>The customer logs in and get his customer id from the db if the name/password is correct!<BR><BR>On the next page that the customer is redirected to when the name/password is correct I want to get the customers name, company etc from that specific column where this customer has his id!<BR><BR>Example.<BR>A customer named Martin has the ID number 34 in the access db!<BR>When Martin logs in with correct name/password, he gets his id number 34.<BR><BR>Now, on the next page where Martin is redirected to, I want to get Martins name, company, adress etc from his cols in the db to be written to the HTML document!<BR><BR>I really don´t know the SQL commands for getting data just from a column with a specific number in a table!<BR><BR>Thanks dudes!<BR>And excuse my bad english!<BR><BR>please mail if you guys do a input!<BR>trytogetin@hotmail.com

  2. #2
    Shawn Clabough Guest

    Default RE: Problem with getting data from the same col in an Access DB!

    You&#039ll need to use something in the form of "SELECT name, company, address FROM CustomerTable WHERE ID = " & numID

  3. #3
    Martin, Sweden Guest

    Default Thanks!, But I don´t know how to get the values outwritten!

    Thanks for your help!<BR>But I still don´t know how to get the name, adress etc to be outwritten on the page!<BR><BR>I want the values from the db: kfornamn, kefternamn, kadress, kpostadress, kpostnummer to be outwritten on the HTML page!<BR><BR>The code looks like this:<BR><BR><BR>Response.Buffer = True<BR><BR>Dim kundID<BR>kundID = Request.Cookies("Kund")<BR><BR>Dim DBconnection, strConnection, SQLstr<BR>strConnection = "Driver={Microsoft Access Driver (*.mdb)};DBQ=c:inetpubwwwroot estdb estDB.mdb"<BR>Set DBconnection = Server.CreateObject("ADODB.Connection")<BR>DBconne ction.Open strConnection<BR>SQLstr = "SELECT kfornamn, kefternamn, kadress, kpostadress, kpostnummer FROM kunder WHERE kkundID = " & kundID<BR>DBconnection.Execute(SQLstr)<BR><BR>DBco nnection.Close<BR>Set DBconnection = Nothing<BR><BR><BR><BR><BR><BR>Thanks dudes

  4. #4
    John Weeflaar Guest

    Default RE: Thanks!, But I don´t know how to get the values outwritten!

    What you need now is to assign the<BR>result to a recordset variable. So, after:<BR>SQLstr = "SELECT kfornamn, kefternamn, kadress, kpostadress, kpostnummer FROM kunder WHERE kkundID = " & kundID<BR>you&#039ll write:<BR><BR>Set rs = DBconnection.Execute(SQLstr) <BR>&#039Now rs contains one record for this particular person<BR>&#060;%Response.Write("kfornamn: " & rs("kfornamn"))%&#062;<BR>&#039 add new line here<BR>&#060;%Response.Write("kefternamn: " & rs("kefternamn"))%&#062;<BR><BR>&#039etc<BR><BR>Jo hn<BR><BR><BR>


  5. #5
    Martin, Sweden Guest

    Default Thanks Guys, this really helped me out!

    This really helped me out!<BR>Thank you guys!<BR><BR>Martin, Sweden

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •