View Single Post
Old 11-11-2006, 09:49 AM   #4 (permalink)
reteep
Inactive
 
reteep's Avatar
 
Join Date: 03-20-06
Location: Germany
Posts: 526
iTrader: 0 / 0%
Latest Blog:
C# CSV Import

reteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to all
Send a message via ICQ to reteep
Cool

Fully depends on the database, if it's SQL Server you need to have a connection string in the web.config:

PHP Code:
<add name="LocalSqlServer" connectionString="data source=xx;initial catalog=xx;Integrated Security=SSPI;"/> 
then example:

PHP Code:
using System.Data.SqlClient;

System.Data.SqlClient.SqlConnection cn;
this.cn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString);

 
SqlCommand cmd = new SqlCommand();
            
SqlDataReader dr;

            
cmd.Connection this.cn;
            
cmd.CommandText "SELECT kwID FROM xx WHERE userID='" this.UserID "'";

            
cn.Open();
            
dr cmd.ExecuteReader();

            
dr.Read(); // We only need a single Read Run here cuz we want to get the oldest result ~
            
kwID dr["kwID"].ToString();
            
dr.Close(); 
hth
reteep is offline   Reply With Quote