i have table like this............
sno name father_name hno
1 raju reddy srinivas reddy 2-3-4
2 praveen reddy raju vardhan 3-8-9
3 praveen goud raju 2-3-44/0
4 srinu shashireddy 3-9-344
5 narsimha goud veeresh 2-3-698/a/12
when i entered text like in textbox="2-3" i want select 2-3 series house no rows
PLZ WRITE CSHARP CODE...................
i want like that O/P...........
sno name father_name hno
1 raju reddy srinivas reddy 2-3-4
3 praveen goud raju 2-3-44/0
5 narsimha goud veeresh 2-3-698/a/12
Loading
Satyapriya NayakPosted Nov 25, 2013, 3:23 AM
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.OleDb;
namespace Search
{
public partial class Form1 : Form
{
string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["dsn"];
OleDbCommand com;
OleDbDataAdapter oledbda;
DataSet ds;
string str;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection(ConnectionString);
con.Open();
str = "select * from student where hno like '" + textBox1.Text + "%'";
com = new OleDbCommand(str, con);
oledbda = new OleDbDataAdapter(com);
ds = new DataSet();
if (Convert.ToBoolean(oledbda.Fill(ds, ("student"))))
{
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "student";
MessageBox.Show("match found");
}
else
{
MessageBox.Show("match not found");
}
con.Close();
}
}
}