我将triong converto string转换为xml但是当代码运行时#34;值不能为null"怎么能解决这个问题?项目在Windows Phone 8中运行
public string baslıkbul(baslıkı ba)
{
SqlConnection bag = new SqlConnection(ConfigurationManager.ConnectionStrings["baglantı"].ConnectionString.ToString());
bag.Open();
SqlCommand yap = new SqlCommand("select Baslık from AN where AD=@ad",bag);
yap.Parameters.AddWithValue("@ad", ba.AD);
yap.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(yap);
DataSet ds = new DataSet();
da.Fill(ds);
string s = ds.GetXml(); /// this line is running
XmlReader okuyucu = XmlReader.Create(new StringReader(s));
while(okuyucu.Read())
{
if(okuyucu.NodeType==XmlNodeType.Element)
{
switch(okuyucu.Name)
{
case"Baslık":
s = Convert.ToString(okuyucu.ReadString());
s = ba.Baslık;
break;
}
}
}
bag.Close();
return ba.Baslık;