Click here to Skip to main content
15,899,313 members
Home / Discussions / C#
   

C#

 
Questiondisplaying data from 1 form to another Pin
csanda122-Nov-07 22:46
csanda122-Nov-07 22:46 
AnswerRe: displaying data from 1 form to another Pin
Andrei Ungureanu22-Nov-07 22:48
Andrei Ungureanu22-Nov-07 22:48 
GeneralRe: displaying data from 1 form to another Pin
csanda122-Nov-07 22:50
csanda122-Nov-07 22:50 
GeneralRe: displaying data from 1 form to another Pin
Andrei Ungureanu22-Nov-07 22:54
Andrei Ungureanu22-Nov-07 22:54 
GeneralRe: displaying data from 1 form to another Pin
Andrei Ungureanu22-Nov-07 23:01
Andrei Ungureanu22-Nov-07 23:01 
GeneralRe: displaying data from 1 form to another Pin
csanda122-Nov-07 23:12
csanda122-Nov-07 23:12 
GeneralRe: displaying data from 1 form to another Pin
Andrei Ungureanu22-Nov-07 23:25
Andrei Ungureanu22-Nov-07 23:25 
GeneralRe: displaying data from 1 form to another Pin
csanda123-Nov-07 0:22
csanda123-Nov-07 0:22 
Ok its like this.Form1 has txtsearch and button1 for search.When u type the company name in the textbox and click the button it shows the update form.
This code is in form1
private void button1_Click(object sender, EventArgs e)
{
string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=datatry.mdb";
string Company = txtSearch.Text;
string select = "SELECT * FROM ecmain WHERE CompanyName Like '" + Company + "'";
OleDbConnection datatryConn = new OleDbConnection(strConnection);
datatryConn.Open();

OleDbDataAdapter da = new OleDbDataAdapter(select, datatryConn);
DataSet ds = new DataSet();

da.Fill(ds, "ecmain");

update frm = new update(txtSearch.Text );
frm.Show();

datatryConn.Close();


Form2 is named update, it has a datagridview and textboxes, now what i need is when I click button1 in form1 the search results to appear in the datagridview in form2

This is the update code in form 2

private void btnUpdate_Click(object sender, EventArgs e)
{

string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=datatry.mdb";

string select = "Update ecmain SET CompanyName ='" + txtCompany.Text + "' , ContactName ='" + txtName.Text + "',ContactSurname='" + txtSurname.Text + "', Designation='" + txtDesignation.Text + "',TelephoneNumber='" + txtTel.Text + "', Faxnumber= '" + txtFax.Text + "', Email='" + txtEmail.Text + "',City/Town='" + txtCity.Text + "',PostCode='" + txtPost.Text + "',NumberofEmployees='" + txtEmployees.Text + "', Export='" + cbxExport.SelectedItem + "',ExportDestinations='" + txtDestination.Text + "', SIC Product 1='" + txtSic1.Text + "', Product1_Description='" + txtProduct1.Text + "', SICProduct2='" + txtSic2.Text + "', Product2Description='" + txtProduct2.Text + "', SICProduct3='" + txtSic3.Text + "', Product3Description='" + txtProduct3.Text + "', GeneralComments='" + txtComment.Text + "', Complete='" + cbxComplete.SelectedItem + "' Where CompanyName='" + txtSearch.Text + "'";
OleDbConnection datatryConn = new OleDbConnection(strConnection);
OleDbCommand cmd = new OleDbCommand(select, datatryConn);

datatryConn.Open();
cmd.ExecuteNonQuery();
datatryConn.Close();
MessageBox.Show("Updated successfully!");
}


csanda
GeneralRe: displaying data from 1 form to another Pin
Andrei Ungureanu23-Nov-07 1:13
Andrei Ungureanu23-Nov-07 1:13 
GeneralRe: displaying data from 1 form to another Pin
Pete O'Hanlon23-Nov-07 1:17
mvePete O'Hanlon23-Nov-07 1:17 
GeneralRe: displaying data from 1 form to another Pin
Joe22-Nov-07 23:01
Joe22-Nov-07 23:01 
GeneralRe: displaying data from 1 form to another Pin
benjymous22-Nov-07 23:27
benjymous22-Nov-07 23:27 
GeneralRe: displaying data from 1 form to another Pin
csanda122-Nov-07 23:15
csanda122-Nov-07 23:15 
GeneralRe: displaying data from 1 form to another Pin
benjymous22-Nov-07 23:48
benjymous22-Nov-07 23:48 
AnswerRe: displaying data from 1 form to another Pin
Aparna.B23-Nov-07 1:05
Aparna.B23-Nov-07 1:05 
QuestionHow to apply styles to excel ? Pin
tr_thorn22-Nov-07 22:40
tr_thorn22-Nov-07 22:40 
QuestionGenerics question 2 Pin
calendarw22-Nov-07 22:39
calendarw22-Nov-07 22:39 
QuestionPop-Out like window Pin
Programm3r22-Nov-07 22:23
Programm3r22-Nov-07 22:23 
Questionhow to export an html image file into pdf format Pin
chithra.r22-Nov-07 21:53
chithra.r22-Nov-07 21:53 
AnswerRe: how to export an html image file into pdf format Pin
dan!sh 22-Nov-07 22:00
professional dan!sh 22-Nov-07 22:00 
AnswerRe: how to export an html image file into pdf format Pin
pmarfleet22-Nov-07 22:04
pmarfleet22-Nov-07 22:04 
QuestionHow to pass multiple parameter SqlParameter in one? Pin
TheShihan22-Nov-07 21:37
TheShihan22-Nov-07 21:37 
AnswerRe: How to pass multiple parameter SqlParameter in one? Pin
N a v a n e e t h22-Nov-07 21:54
N a v a n e e t h22-Nov-07 21:54 
GeneralRe: How to pass multiple parameter SqlParameter in one? Pin
TheShihan22-Nov-07 22:41
TheShihan22-Nov-07 22:41 
AnswerRe: How to pass multiple parameter SqlParameter in one? Pin
pmarfleet22-Nov-07 21:56
pmarfleet22-Nov-07 21:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.