6
Reply

showing sql command not properly ended

LOGANATHAN V

LOGANATHAN V

Mar 9 2011 3:52 PM
2.5k
i have to search the employee details by loanid. the  details are available in 3tables. i have used join query to display but it shows error kindly solve my problem.

c# coding.

 try
            {
                //Search Employee Details
                Oracle.DataAccess.Client.OracleConnection cn = new Oracle.DataAccess.Client.OracleConnection();
                cn.ConnectionString = "user id=system; password=system;";
                Oracle.DataAccess.Client.OracleCommand cmd = new Oracle.DataAccess.Client.OracleCommand();
                cmd.Connection = cn;
                //cn = new Oracle.DataAccess.Client.OracleConnection();
                cmd.CommandText = " select deposit.loanid, form1.empedoj, form1.empshare, sharecapital.shareint, sharecapital.loandt, sharecapital.loandeduc, sharecapital.dividend, sharecapital.sharetot from form1, deposit , sharecapital where deposit.loanid(+) = sharecapital.loanid = '" + txtlnid.Text.Trim() + "'";  // shows sql command not properly ended
                Oracle.DataAccess.Client.OracleDataAdapter ada = new Oracle.DataAccess.Client.OracleDataAdapter(cmd);
                System.Data.DataTable dt = new DataTable();
                dt.Clear();
                ada.Fill(dt);
                
                //Display in Textbox
                if (dt.Rows.Count > 0)
                {
                    txtlnid.Text = dt.Rows[0].ItemArray[0].ToString();
                    admdate.Text = dt.Rows[0].ItemArray[1].ToString();
                    txtadmamt.Text = dt.Rows[0].ItemArray[2].ToString();
                    txtadmint.Text = dt.Rows[0].ItemArray[3].ToString();
                    loandt.Text = dt.Rows[0].ItemArray[4].ToString();
                    txtlnamt.Text = dt.Rows[0].ItemArray[5].ToString();
                    txtlnint.Text = dt.Rows[0].ItemArray[6].ToString();
                    txtsctot.Text = dt.Rows[0].ItemArray[7].ToString();
                    

                }
                if (cn.State == ConnectionState.Closed)
                {
                    cn.Open();
                }
                string str;
                str = cmd.ExecuteScalar().ToString();
                if (str != null)
                {
                    MessageBox.Show("Record Found");
                }
                else
                {
                    MessageBox.Show("ID not Match");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
               

Answers (6)