View Single Post
  #1 (permalink)  
Old September 26th, 2010, 06:37 AM
Cade_Feng Cade_Feng is offline
Authorized User
 
Join Date: Aug 2010
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Cade_Feng
Post Get a certain Field's valuer from DataBase

Hi,

I want to get a certain field's value from Database;

But I don't know how to get it;

Code:
string _StuName=string.Empty;
SqlConnectionStringBuilder _sqlCon = new SqlConnectionStringBuilder();
_sqlCon.DataSource=".";
_sqlCon.InitialCatalog="Test";
_sqlCon.IntegratedSecurity=true;
SqlConnection con = new SqlConnection(_sqlCon.ConnectionString);
SqlCommand command = new SqlCommand(@"select top 1 StudentName from StudentInfo");
Then How can I got "StudentName" this Field's value?
And keep it.
__________________
Wana be a .net developer.
Sincere yours
Cade_Feng