查询方法

string name = this.cobnianji.Text.Trim();
DataTable dt = new DataTable();
string sql = string.Format("SELECT[xingming], [nianji],[xuehao]FROM [dbo].[123] where[xingming]='{0}'", name);
SqlDataAdapter ds = new SqlDataAdapter(sql, DBHelpercs.StrConn);
ds.Fill(dt);
this.jk.DataSource = dt;

连表联查代码 :SELECT[Brand],[Type],[price],[size] ,[Weight] ,[Style] FROM [dbo].[MobileInfo],[dbo].[MobileBrand] where Brand='{0}'

posted @ 2017-10-27 15:55  王钰鑫  阅读(135)  评论(0编辑  收藏  举报