AliRazoR
Advanced Member level 4
Hi
i want to create a simple search button in visual studio but it gives error, here is the code:
thanks in advance
i want to create a simple search button in visual studio but it gives error, here is the code:
Code C++ - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace searchbutton { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btn_search_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\searchbutton.mdf;Integrated Security=True;User Instance=True"); DataTable dt = new DataTable(); SqlDataAdapter SDA = new SqlDataAdapter("SELECT * FROM searchbutton.mdf where id like" + txt_id.Text, conn); SDA.Fill(dt); dataGridView1.DataSource = dt; } } }
thanks in advance
Attachments
Last edited by a moderator: