2014-04-30 22 views
0

我想從SQL Server中將數據庫顯示爲使用C#的GridView,並且想要在控件中顯示圖像。我正在使用下面的代碼來顯示數據庫。如何在GridView控件中顯示圖像

protected void txtsinglesearch_TextChanged(object sender, EventArgs e) 
{ 
    if (DropDownList1.SelectedItem.Text == "First Name") 
    { 
     string q = "select * from facultyreg where fname like'" + txtsinglesearch.Text.ToString() + "%' "; 
     sda = new SqlDataAdapter(q, con); 
     ds = new DataSet(); 
     sda.Fill(ds, "facultyreg"); 
     grdvw_sigsrch_by_name.DataSource = ds.Tables[0]; 
     grdvw_sigsrch_by_name.DataBind(); 
    } 
} 

這段代碼是TextBox的TextChanged事件,我正在尋找從數據庫中的首字母,並在GridView顯示結果裏面

+0

你在數據庫使用的數據類型爲image列的表的例子? – Amitesh

+0

http://www.dotnetsharepoint.com/2013/11/how-to-display-images-in-gridview-from.html#.U2DQB1fkW使用此鏈接 – Amitesh

回答