hii buddy
the main problem that you r using values keyword for select query...
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;
public partial class Update : Form
{
SqlConnection con;
SqlDataReader dr;
public Update()
{
InitializeComponent();
}
private void Update_Load(object sender, EventArgs e)
{
con = new SqlConnection("Data Source=.;Initial Catalog=alsofi;Integrated Security=True");
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void button6_Click(object sender, EventArgs e)
{
try
{
con.Open();
String q = "Select * from Development_Detal where EmpId='" + EmpID.Text + "'";
SqlCommand cmd = new SqlCommand(q, con);
if (EmpID.Text == "")
{
MessageBox.Show("Search cannot be made for Null valuse Insert EmpID ");
}
else
{
dr = cmd.ExecuteReader();
while (dr.Read())
{
Ename.Text = dr.GetValue(0).ToString();
UserPass.Text = dr.GetValue(1).ToString();
emaill.Text = dr.GetValue(4).ToString();
textBox1.Text = dr.GetValue(5).ToString();
address.Text = dr.GetValue(3).ToString();
mobNo.Text = dr.GetValue(6).ToString();
city.Text = dr.GetValue(7).ToString();
MessageBox.Show("Search sucess");
}
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
con.Close();
}
}
}