sno name mobile referalid area
1 shashi 8985500166 15432 hyd
2 vamshi 9014498762 12345 sec
i wnt output like this ......
when i entered mobile no in textbox display name in secondbox and display referal id in third box .................
plz write the code..................

Riyaz AkhtarRank #2,275 · 619 reputationPosted Jun 13, 2013, 11:50 PM EDT
create an event OnTextChanged in your mobile textbox and make AutoPostBack="True" in this textbox. Write code to display name and referal Id in OnTextChanged event
Thanks
RA
Pankaj PandeyRank #642 · 3.7K reputationPosted Jun 13, 2013, 11:51 PM EDT
sqlconnection conn=new sqlconnection("your connection string");
sqlcommand cmd=new sqlcommand("select top(1) name,referalid from table where mobile='"+textbox1.Text+"'", conn);
sqldataadapter da=new sqldataadapter(cmd);
datatable dt=new datatable();
da.Fill(dt);
textbox2.Text=dt.rows[0]["name"].tostring();
textbox3.Text=dt.rows[0]["referalid"].tostring();
mark as answered if helpfull
Jignesh TrivediRank #16 · 50.3K reputationPosted Jun 14, 2013, 3:04 AM EDT
i think this is same as
http://www.c-sharpcorner.com/Forums/Thread/213479/read-the-values-fraom-table.aspx
Satyapriya NayakRank #47 · 31.5K reputationPosted Jun 14, 2013, 5:26 AM EDT
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 Textbox_related_data
{
public partial class Form1 : Form
{
string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["dsn"];
OleDbCommand com;
string str;
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
textBox2.Text = "";
textBox3.Text = "";
OleDbConnection con = new OleDbConnection(ConnectionString);
con.Open();
str = "select * from emp where mobile='" + textBox1.Text + "'";
com = new OleDbCommand(str, con);
OleDbDataReader reader = com.ExecuteReader();
while (reader.Read())
{
textBox2.Text = reader["name"].ToString();
textBox3.Text = reader["referalid"].ToString();
}
con.Close();
reader.Close();
}
}
}