Moti Mashiah
asked on
C# Help
Hi Guys ,
I'm beginner with C# and I would like to get some help from online teacher I need some private teacher\programmer who knows C# in good level.
I'm in a middle of building my new application and My intention is to finish my build application soon.
Thanks ,
I'm beginner with C# and I would like to get some help from online teacher I need some private teacher\programmer who knows C# in good level.
I'm in a middle of building my new application and My intention is to finish my build application soon.
Thanks ,
ASKER
I know that and thank you very much but still I would like somebody that I can talk with for at least couple of hours and get some good suggestion and learning.
A google search shows a couple of different live options, all which cost.
The only other options are message boards such as this where you need to ask apecific questions and online tutorials of which there are many.
Microsoft has lots of great information that would help you get started
http://msdn.microsoft.com/en-us/library/kx37x362.aspx
Michael
The only other options are message boards such as this where you need to ask apecific questions and online tutorials of which there are many.
Microsoft has lots of great information that would help you get started
http://msdn.microsoft.com/en-us/library/kx37x362.aspx
Michael
ASKER
Guys ,
I'm trying to finish my build windows application with C# so as your suggestion I will post my question here.
I have created comboBox and filled with one column, after I choose item from the combobox I would like to display other column in the textboxs so I wrote code to make it happen but what if I want to choose column from another table I mean I would like to display couple of columns from two different table in the textbox when I hit the combobox items Here is my code:
private void comboLname_SelectedIndexCh anged(obje ct sender, EventArgs e)
{
string conn = "Data Source=srv-db-02;Initial Catalog=rmsmasterdbtest;Pe rsist Security Info=True;User ID=test;Password=masterB4" ;
string Query = "select * from rmsmasterdbtest.dbo.custom er join where LastName= '" + comboLname.Text + "' ;";
SqlConnection Myconn = new SqlConnection(conn);
SqlCommand cmdDataBase = new SqlCommand(Query, Myconn);
SqlDataReader Reader;
try
{
Myconn.Open();
Reader = cmdDataBase.ExecuteReader( );
while (Reader.Read())
{
string ID = Reader.GetInt32(Reader.Get Ordinal("I D")).ToStr ing();
string AccountNuber = Reader.GetString(Reader.Ge tOrdinal(" AccountNum ber")).ToS tring();
//string Time = Reader.GetString(Reader.Ge tOrdinal(" Time"));
// string Deposit = Reader.GetString(Reader.Ge tOrdinal(" Deposit")) ;
string sstatus = Reader.GetString(Reader.Ge tOrdinal(" status"));
string slastname = Reader.GetString(Reader.Ge tOrdinal(" lastname") );
txtid.Text = ID;
txtacnum.Text = AccountNuber;
//txttime.Text = Time;
//txtdeposit.Text = Deposit;
txtstatus.Text = sstatus;
txtlname.Text = slastname;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message );
}
finally
{
Myconn.Close();
}
}
private void button1_Click(object sender, EventArgs e)
{
string conn = "Data Source=srv-db-02;Initial Catalog=rmsmasterdbtest;Pe rsist Security Info=True;User ID=test;Password=masterB4" ;
string Query = "update rmsmasterdbtest.dbo.custom er set lastname='" + this.txtlname.Text + "' ,status='" + this.txtstatus.Text + "' where lastname='" + this.txtlname.Text + "' ;";
SqlConnection Myconn = new SqlConnection(conn);
SqlCommand cmdDataBase = new SqlCommand(Query, Myconn);
SqlDataReader Reader;
try
{
Myconn.Open();
Reader = cmdDataBase.ExecuteReader( );
MessageBox.Show("Updated") ;
while (Reader.Read())
{
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message );
}
finally
{
Myconn.Close();
}
}
I'm trying to finish my build windows application with C# so as your suggestion I will post my question here.
I have created comboBox and filled with one column, after I choose item from the combobox I would like to display other column in the textboxs so I wrote code to make it happen but what if I want to choose column from another table I mean I would like to display couple of columns from two different table in the textbox when I hit the combobox items Here is my code:
private void comboLname_SelectedIndexCh
{
string conn = "Data Source=srv-db-02;Initial Catalog=rmsmasterdbtest;Pe
string Query = "select * from rmsmasterdbtest.dbo.custom
SqlConnection Myconn = new SqlConnection(conn);
SqlCommand cmdDataBase = new SqlCommand(Query, Myconn);
SqlDataReader Reader;
try
{
Myconn.Open();
Reader = cmdDataBase.ExecuteReader(
while (Reader.Read())
{
string ID = Reader.GetInt32(Reader.Get
string AccountNuber = Reader.GetString(Reader.Ge
//string Time = Reader.GetString(Reader.Ge
// string Deposit = Reader.GetString(Reader.Ge
string sstatus = Reader.GetString(Reader.Ge
string slastname = Reader.GetString(Reader.Ge
txtid.Text = ID;
txtacnum.Text = AccountNuber;
//txttime.Text = Time;
//txtdeposit.Text = Deposit;
txtstatus.Text = sstatus;
txtlname.Text = slastname;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message
}
finally
{
Myconn.Close();
}
}
private void button1_Click(object sender, EventArgs e)
{
string conn = "Data Source=srv-db-02;Initial Catalog=rmsmasterdbtest;Pe
string Query = "update rmsmasterdbtest.dbo.custom
SqlConnection Myconn = new SqlConnection(conn);
SqlCommand cmdDataBase = new SqlCommand(Query, Myconn);
SqlDataReader Reader;
try
{
Myconn.Open();
Reader = cmdDataBase.ExecuteReader(
MessageBox.Show("Updated")
while (Reader.Read())
{
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message
}
finally
{
Myconn.Close();
}
}
ASKER
Here is screenshot of my application see attachment and pay attention to the note
image.jpg
image.jpg
string Query = "select * from rmsmasterdbtest.dbo.custom er join where LastName= '" + comboLname.Text + "' ;";
alter this(above) query, join the other table which gives deposit , time and read that same way as ur doing currently
alter this(above) query, join the other table which gives deposit , time and read that same way as ur doing currently
ASKER
thank you for the suggestion I was trying to do it but I got some " incorrect syntax near the keyword order" (order is my second table)
here is the line I wrote:
string Query = "select * from rmsmasterdbtest.dbo.custom er join order where LastName= '" + comboLname.Text + "' ;";
here is the line I wrote:
string Query = "select * from rmsmasterdbtest.dbo.custom
"select t1,*, t2.column1, t2.column2 from Table1 t1 inner join Table2 t2 on t1.JoinColumn=t2.JoinColum n where LastName='"+comboLname.Tex t + "';";
ASKER
Thanks for the quick respond I was writing the way you suggest and still got syntax error.
Look below the code I wrote by your instruction
string Query = "select customer,*, order.time, order.deposit from customer customer inner join order order on customer.JoinColumn=order. JoinColumn where LastName='"+comboLname.Tex t + "';";
Table 1 - custumer
Table 2 - order
customer columns - id, accountnumber, lastname
order columns - time, deposit,
Look below the code I wrote by your instruction
string Query = "select customer,*, order.time, order.deposit from customer customer inner join order order on customer.JoinColumn=order.
Table 1 - custumer
Table 2 - order
customer columns - id, accountnumber, lastname
order columns - time, deposit,
"select c.id, c.lastname, c.accountnumber, o.time, o.deposit from customer c right outer join order o on c.JoinColumn=o.JoinColumn where c.code2='" + comboLname.Text + "';";
ASKER
this is how I placed it now and still it gives me the syntax "incorrect order message"
string Query = "select c.id, c.lastname, c.accountnumber, o.time, o.deposit from customer c right outer join order o on c.JoinColumn=o.JoinColumn where lastname='" + comboLname.Text + "';";
string Query = "select c.id, c.lastname, c.accountnumber, o.time, o.deposit from customer c right outer join order o on c.JoinColumn=o.JoinColumn where lastname='" + comboLname.Text + "';";
ASKER
here is another example:
string Query = "select c.id, c.lastname, c.accountnumber, o.time, o.deposit from customer c right outer join order o on c.JoinColumn=o.JoinColumn where lastname='" + comboLname.Text + "';";
string Query = "select c.id, c.lastname, c.accountnumber, o.time, o.deposit from customer c right outer join order o on c.JoinColumn=o.JoinColumn where lastname='" + comboLname.Text + "';";
ASKER
Please see attachment with my Combobox code
ComaboboxCode.png
ComaboboxCode.png
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi There
After a lot of effort I coudn't joined two table together so I decided to make it easier and create one new table in my SQL server and combined all these columns togethre
see attachment....
After everything works fine I added another column "Status" and give him value nvarchar(max) now when I launch my application and I get some error see attachment status.
newtable.png
status.png
After a lot of effort I coudn't joined two table together so I decided to make it easier and create one new table in my SQL server and combined all these columns togethre
see attachment....
After everything works fine I added another column "Status" and give him value nvarchar(max) now when I launch my application and I get some error see attachment status.
newtable.png
status.png
ASKER
It was part of the soliton and helpful for my code
Michael