贴代码:大家请看!

SqlConnection conn = new SqlConnection();
            conn.ConnectionString = connectionString;
            conn.Open();//数据库的连接
            SqlCommand cmd = conn.CreateCommand();          
            string local_time = DateTime.Now.ToString();
            string lname = txt2.Text.ToString();         
            SqlDataAdapter sda = new SqlDataAdapter("select *from books WHERE LNAME='" + lname + "'", conn);
            DataSet ds = new DataSet();
            sda.Fill(ds);
            string condition = ds.Tables[0].Rows[0]["LCONDITION"].ToString().Trim();//Row表示第几行,
            ["LCONDITION"]表示我要得到的字段!
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐