Click here to Skip to main content
15,906,567 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
can any one tell me wot is the return type for that function.. is it bool. i am setting up database layer for three tier.


C#
public returntype dBl(empProps p)

           try
           {
               MAconn = new OleDbConnection();
               MAconn.ConnectionString = connectionString;
               MAconn.Open();
               DataSet oDS = new DataSet();

               string query = "SELECT * FROM info";

               OleDbDataAdapter oOrdersDataAdapter = new OleDbDataAdapter(query, connectionString);

               OleDbCommandBuilder oOrdersCmdBuilder = new OleDbCommandBuilder(oOrdersDataAdapter);

               oOrdersDataAdapter.Fill(oDS);

               DataTable pTable = oDS.Tables["Table"];
               pTable.TableName = "info";

               // Insert the Data
               DataRow oOrderRow = oDS.Tables["info"].NewRow();
               oOrderRow["name"] = p.name;
               oOrderRow["cell"] = p.cell;
               oDS.Tables["info"].Rows.Add(oOrderRow);
               //oDS.Tables["Orders"].Rows.Add(oOrderRow);
               oOrdersDataAdapter.Update(oDS, "info");
               MessageBox.Show("inserted");
           }catch(Exception ex)
           { MessageBox.Show("some prob"+ex);}
Posted
Updated 19-May-11 13:34pm
v2
Comments
Dalek Dave 19-May-11 19:35pm    
Edited for code block

You determine what the return type should be, or don't have one (void)... as of now, it returns nothing that I can see...
 
Share this answer
 
in above funcation its returen type is void.Another thing is it will not have any returen type in case if it is a Constructer.
 
Share this answer
 
v2
Agree with fcronin and CS2011:

Since you are inserting a record in the Data Layer of three tier architecture for which you are receiving an object (with inserted values) as parameter. So, you don't require to return any value, hence void should be applicable.
 
Share this answer
 
Comments
codegeekalpha 20-May-11 0:24am    
sk saini u mean that code is correct for database layer.. now i just cocentrate on business layer and presentation layer... ???

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