C# dataSet 读出的与实际不符

来源:百度知道 编辑:UC知道 时间:2024/06/13 15:54:57
下面是我写的一段查询代码,实现选择不用的字段查询不同的内容,可我运行的时候要么就查不出任何结果,要么查出的结果与我DB里内的完全不一样.
另外,我想实现在 dataGridView控件中修改后,按确认按钮就能同步更新DB,该怎么写呀...
极度求助中.....
请帮我看看到底是怎么回事,谢谢!!!

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 Money
{
public partial class payRoll : Form
{
public static SqlConnection conn;
public static string re;
public static string s=string.Format("select a.name,b.* from localuser a,"+"gongzi b,personal c where a.id=b.id and a.id=c.id and ");
private void payRoll_Load(object sender, EventArgs e)
{
string sqlcon = string.Format("Data Source=范;Initial Catalog=money;"+ "Persist Security Info=True;User ID=sa;Password=123");
conn = new SqlConnection(sqlcon);
cbSelect.SelectedIndex =

代码写的真乱,才80行都这么乱了,不行啊。
要养成一个良好的习惯哦,提提建议而已。
难度不大,就是今天不想看了,写的太乱了。

大哥,这么多乱码~~ 看着都眼花,你也给点分~,激励下啊~~~