Click here to Skip to main content
15,915,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#


//i have created dll
DLL
C#
public string Open(string sql)
        {
            try
            {
                //if (con.State != System.Data.ConnectionState.Open)
                if (!Connect())
                    return "Database connection error";

                cmd = new OleDbCommand(sql, con);
                da = new OleDbDataAdapter(sql, con);
                DataSet ds = new DataSet();
                da.Fill(ds);
                return Convert.ToString(ds);
               // return "sucessfully open";

            }
            catch (Exception ex)
            {
                return ex.ToString();

            }
        }


C# CODE
C#
string sql = "SELECT Part_No, No_Of_Teeth, [Module], PA_Deg, PA_Min, PA_Sec, HA_Deg, HA_Min, HA_Sec, Od, Corr_Fact_X, Ball_Pin_Dia, Dimm_Over_PB, Span_Tooth,Span_Measurement, Act_DimOverBall FROM GearData";
     
           string ds = db.Open(sql);
           for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
               cmbprtno.Items.Add(ds.Tables[0].Rows[i][0].ToString());
           cmbprtno.Text = Convert.ToString(ds.Tables[0].Rows[0]["Part_No"].ToString());



//
Posted
Comments
[no name] 6-May-14 10:45am    
What is it exactly that you think Convert.ToString(ds); is going to do?
thatraja 6-May-14 11:33am    
Spot on

1 solution

If I am not wrong have you used the

if(!Ispostback)
in your page_load method
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900