本文介绍了如何将自动生成的数字从sql插入语句绑定到表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public static void AddNewInventory(string stu_name, string address, string Phone, string date)
        {
            string sql = "BEGIN Insert into I_Student " +
                "Student_ID, STU_Name, Address, Phone, DATE " +
                   "Values(I_Student_ID.NextVAL, :STU_Name, :Address, :Phone,to_date(:DATE, 'MM/DD/YYYY HH24:MI:SS')); END; ";

            Console.WriteLine("Insert SQL = " + sql.ToString());
            OracleDatabase db = (OracleDatabase)DatabaseFactory.CreateDatabase("PHTS");

            using (System.Data.Common.DbCommand cmd = db.GetSqlStringCommand(sql))
            {


                db.AddInParameter(cmd, "STU_Name", DbType.String,stu_name);
                db.AddInParameter(cmd, "Address", DbType.String,address);
                db.AddInParameter(cmd, "Phone", DbType.String,Phone);
                db.AddInParameter(cmd, "DATE", DbType.String,date);

               db.ExecuteNonQuery(cmd);

            }

        }
    }




如何将自动生成的号码绑定到文本框




How can I bind the auto generated number to a textbox

推荐答案


这篇关于如何将自动生成的数字从sql插入语句绑定到表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 09:35