如果是该代码,wot将是返回类型... [英] wot wil be the return type in case of that code...

查看:83
本文介绍了如果是该代码,wot将是返回类型...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以告诉我wot是该函数的返回类型吗.我将数据库层设置为三层.


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.


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);}

推荐答案

您确定返回类型应该是什么,或者没有返回值(void)……到目前为止,它什么也不返回我可以看到...
You determine what the return type should be, or don''t have one (void)... as of now, it returns nothing that I can see...


在上面的函数中,它的returen类型是void.另一件事是,如果它是一个Constructor,它将没有任何returen类型.
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.


同意fcronin和CS2011:

由于您要在三层体系结构的数据层中插入一条记录,因此您要接收一个对象(具有插入的值)作为参数.因此,您不需要返回任何值,因此void应该适用.
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.


这篇关于如果是该代码,wot将是返回类型...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆