1 Replies - 2704 Views - Last Post: 17 March 2010 - 04:48 AM Rate Topic: -----

#1 xoops  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 81
  • Joined: 06-August 09

how to get value query sql in asp.net c#

Posted 16 March 2010 - 10:14 PM

hello all,

i want to question how to i get value query sql in asp.net c#
example:
this is my sample code:

  
      string no_hp = "";
   
      string queryNoHP = "SELECT NO_HP FROM REF_OWNER WHERE ID = '" + ID.Text + "'";



i want to how to get value from my query, example field NO_HP into my variable (no_hp). Thanks for your help..

Is This A Good Question/Topic? 0
  • +

Replies To: how to get value query sql in asp.net c#

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: how to get value query sql in asp.net c#

Posted 17 March 2010 - 04:48 AM

take a look into the SqlConnection class, SqlCommand class, and SqlCommand.ExecuteScalar method

This is only assuming you are using SQL Server, since you gave no indication of what database you are using.

This post has been edited by eclipsed4utoo: 17 March 2010 - 04:49 AM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1