| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 595 人关注过本帖
标题:插入数据库数据
只看楼主 加入收藏
yuxin1382
Rank: 1
等 级:新手上路
帖 子:172
专家分:0
注 册:2006-12-8
结帖率:50%
收藏
 问题点数:0 回复次数:0 
插入数据库数据
string txt_tdh_1 = Request.Form["txt_tdh"];
        string txt_djr_1 = Request.Form["txt_djr"];
        string  txt_djrq_1 = Request.Form["txt_djrq"];
        string ddl_rjmc_1 = ddl_rjmc.DataValueField.ToString();
        string ddl_wtmk_1 = ddl_wtmk.DataValueField.ToString();
        string ddl_khmc_1 = ddl_khmc.DataValueField.ToString();
        string txt_wtjs_1 = Request.Form["txt_wtjs"];
        string txt_wtms_1 = Request.Form["txt_wtms"];
        Insert_TempSql = "INSERT INTO TD_WT_DJB([WT_Tdbh],[WT_Tddjr],[WT_Tddjrq],[WT_Tdrjmc],[WT_Tdwtmk],[WT_Tdkhmc],[WT_Tdwtjs],[WT_Tdwlms])  VALUES(@WT_Tdbh,@WT_Tddjr,@WT_Tddjrq,@WT_Tdrjmc,@WT_Tdwtmk,@WT_Tdkhmc,@WT_Tdwtjs,@WT_Tdwlms)";
        string connstring = System.Configuration.ConfigurationManager.AppSettings["TD_Conn"];
        SqlConnection TD_conn = new SqlConnection(connstring);
        TD_conn.Open();
        SqlCommand TD_scd = new SqlCommand();
        TD_scd.Connection = TD_conn;
        TD_ = Insert_TempSql;
        TD_scd.Parameters.Add("@WT_Tdbh", SqlDbType.Char,12).Value = txt_tdh_1;
        TD_scd.Parameters.Add("@WT_Tddjr", SqlDbType.Char,20).Value = txt_djr_1;
        TD_scd.Parameters.Add("@WT_Tddjrq", SqlDbType.DateTime).Value = txt_djrq_1;
        TD_scd.Parameters.Add("@WT_Tdrjmc", SqlDbType.Char,20).Value = ddl_rjmc_1;
        TD_scd.Parameters.Add("@WT_Tdwtmk", SqlDbType.Char,20).Value = ddl_wtmk_1;
        TD_scd.Parameters.Add("@WT_Tdkhmc", SqlDbType.Char,20).Value = ddl_khmc_1;
        TD_scd.Parameters.Add("@WT_Tdwtjs", SqlDbType.Char,50).Value = txt_wtjs_1;
        TD_scd.Parameters.Add("@WT_Tdwlms", SqlDbType.VarChar,255).Value = txt_wtms_1;

        TD_scd.ExecuteNonQuery();
        TD_conn.Close();
执行到TD_scd.ExecuteNonQuery();老是提示:被准备语句 '(@WT_Tdbh char(12),@WT_Tddjr char(20),@WT_Tddjrq datetime,@WT_Td' 需要参数 @WT_Tdbh,但未提供该参数。
搜索更多相关主题的帖子: ddl string 数据库 txt Form 
2008-05-21 16:34
快速回复:插入数据库数据
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025263 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved