| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 720 人关注过本帖
标题:[求助]怎么插入不进去数据呢?指点一下!
取消只看楼主 加入收藏
qiushui
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2007-6-13
收藏
 问题点数:0 回复次数:5 
[求助]怎么插入不进去数据呢?指点一下!
string mystring = "server =75E3490002F4413 ; uid = sa; pwd = a418; database = tigerhrmis";
SqlConnection myconnection = new SqlConnection(mystring);
myconnection.Open();
string quarystring = "insert into 员工各项薪酬指标表(员工编号,基本工资,岗位工资,保密费,特殊津贴,绩效,个人社保额,等级薪酬编号) values('"+this.textBox1.Text+" ','"+this.textBox2.Text+"','"+this.textBox3.Text+"','"+this.textBox4.Text+"','"+this.textBox5.Text+"','"+this.textBox6.Text+"','"+this.textBox7.Text+"','"+this.textBox8.Text+"')";
SqlCommand mycommand = new SqlCommand(quarystring, myconnection);
myconnection.Close();
这个是我里面代码,运行没错,填写数据那些都没问题,怎么就是填不进去呢,数据库里面还是空的。高手们指点一下,我才学了几天的C#,很菜,现在都快弄疯了。谢谢呀!
搜索更多相关主题的帖子: 社保 工资 数据 员工 
2007-06-13 20:24
qiushui
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2007-6-13
收藏
得分:0 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{




string mystring = "server =75E3490002F4413 ; uid = sa; pwd = a418; database = tigerhrmis";
SqlConnection myconnection = new SqlConnection(mystring);
myconnection.Open();
string quarystring = "insert into 员工各项薪酬指标表(员工编号,基本工资,岗位工资,保密费,特殊津贴,绩效,个人社保额,等级薪酬编号) values('"+this.textBox1.Text+" ','"+this.textBox2.Text+"','"+this.textBox3.Text+"','"+this.textBox4.Text+"','"+this.textBox5.Text+"','"+this.textBox6.Text+"','"+this.textBox7.Text+"','"+this.textBox8.Text+"')";
SqlCommand mycommand = new SqlCommand(quarystring, myconnection);
myconnection.Close();




}

private void sqlConnection_InfoMessage(object sender, System.Data.SqlClient.SqlInfoMessageEventArgs e)
{

}

private void textBox8_TextChanged(object sender, EventArgs e)
{

}
}
}
这是所有的,就这么点,但是老是找不出来原因,帮忙看一下,谢谢了!

2007-06-13 20:26
qiushui
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2007-6-13
收藏
得分:0 
帮帮忙啊,刚开始学,而且准确地说才学了三天,好多东西还很模糊,但是又很急,必须要做出来,拜托各位了啊!小女子不胜感激呀!
2007-06-13 20:27
qiushui
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2007-6-13
收藏
得分:0 
第 1 行: ',' 附近有语法错误。 加了那句话过后没有显示错误,但是输入数据点了那个button后就出现这个问题了,怎么回事呀,帮我看看啊,
2007-06-13 22:37
qiushui
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2007-6-13
收藏
得分:0 
说是什么“未处理的sqlexception,第 1 行: ',' 附近有语法错误."这个怎么回事呀?/急啊!
2007-06-13 22:39
qiushui
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2007-6-13
收藏
得分:0 
列名 '绩效' 无效。还是那个未处理 sqlexception,显示的就是这个,我疯了
2007-06-13 22:52
快速回复:[求助]怎么插入不进去数据呢?指点一下!
数据加载中...
 
   



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

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