DevTrain Startseite Visual Studio 1 Magazin  
  
  
SUCHEN:  
ARTIKEL ONLINE: 525   

Kategorien
.NET
Datenbanken
Web
XML

Allgemein
Camp
Foren
Events
Persönliche Einstellungen
Registrieren
Prämien Shop
Kontakt
Impressum
Über DevTrain

Autoren



 

Forum: ASP.NET | Thema: DataAdapter and DataRow | Von: G. Guest ( 06.11.2003 15:02)

I have this problem and I dont know the reason.
I need to fetch some information from database and display the corresponding "string" on the dropdownbox which was already populated from Database(say Language field).This is the code:

public void fillKnow()
{
DataSet ds_k=new DataSet();
SqlCommand cm=new SqlCommand("select * from knowledge where address=@add",con);
cm.Parameters.Add("@add",SqlDbType.Int);
cm.Parameters["@add"].Value=(int)Session["user_id"];
SqlDataAdapter dr=new SqlDataAdapter(cm);
SqlCommandBuilder sbul=new SqlCommandBuilder(dr);
dr.Fill(ds_k);
dt=ds_k.Tables[0];
if(dt.Rows.Count != 0)
{
drow=dt.Rows[0];
foreach(ListItem item in mother_tongue.Items)
if(item.Value==drow["mothertongue"].ToString())
item.Selected=true;
else
item.Selected=false;
}
}

"mothertongue" is a field in the table "knowledge"
and mother_tongue is the dropdownbox.

== sign in the if statement under foreach loop doesnt seem to "work".Is it a problem of casting?or anythingelse

vielen dank!




Antworten
Vorsicht bei der Eingabe: Die Zeichen ' oder -- sind nicht erlaubt!

 Betreff:
 Nachricht: Den Beitrag finden Sie nun unter: http://beta.devtrain.de/foren Die Benutzerdaten und Foreninhalte von beta.devtrain.de und www.devtrain.de sind die selben.
Sie können sich dort sogar per RSS über neue Inhalte informieren lassen.
Bei Problemen bitte direkt Mail an asp [AT] ppedv.de.

 Signatur:

  



Login
Username:


Passwort:






Passwort vergessen?

Visual Studio 1 Magazin

© Copyright 2003 ppedv AG