当前位置:编程学习 > C#/ASP.NET >>

c#和sql

求 用c#和sql 写的关于路面管理系统  只要这之类的 比如 沥青路面管理系统  求帮助 本人十分感谢 --------------------编程问答-------------------- 估计你求不到。 --------------------编程问答-------------------- 找一个近似的,改一改套用一下就行了.
你要人家做的与你同样的东西,不是让你和他自己竞争嘛! --------------------编程问答-------------------- 所有的管理系统都是一个模式,从网上档一个源码,看看一改,就是你的了。 --------------------编程问答-------------------- 沥青路面管理系统???


你整理一下需求,自己做,基本的功能涉及到数据的增删改查,报表统计查询打印啥的。 --------------------编程问答-------------------- 这个怎么帮你做找啊,你有没有自己的想法?至少要描述一下你要做什么呀。什么都不说,这个………… --------------------编程问答-------------------- http://download.csdn.net/detail/zhaozheng1988/3745384 --------------------编程问答-------------------- 是呀,你说的沥青路面管理系统具体要实现些什么功能呢? --------------------编程问答--------------------
引用楼主 wangbo8124 的回复:
▪ Google公司的云计算服务有哪些?▪ 医疗行业的CIO们是如何看待云计...▪ 云计算大跃进?▪ 云应用的未来趋势是什么?▪ 相对于公共PaaS,私人PaaS有哪...求 用c#和sql 写的关于路面管理系统  只要这之类的 比如 沥青路面管理系统  求帮助 本人十分感谢


是不是 自己想的这么一个管理系统啊  --------------------编程问答-------------------- 你应该是大学生,要交作业任务了吧,不然张口就要代码
--------------------编程问答-------------------- 这个太专业自己想吧。 --------------------编程问答-------------------- 即使有现成也未必满足你的具体需求 --------------------编程问答-------------------- 去下载一个相似的系统,然后自己在改改 --------------------编程问答-------------------- 沥青路面管理系统是干什么的啊? --------------------编程问答-------------------- 说实话 就是下不到模板 我只是要求满足增删改查  谢谢大家的回复 
哎  这个 还是 想要个模板啊   --------------------编程问答-------------------- 需求明确,这类系统实现都不同小异 --------------------编程问答-------------------- 很简单的,当做毕业设计吧? --------------------编程问答-------------------- 看些有关方面的书,参考一下吧 --------------------编程问答-------------------- 网上搜索下  你该系统的看下,找本书
给你贴一个书上的例子,没有修改更新

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 DatabaseDemo
{
    public partial class Form1 : Form
    {
        SqlDataAdapter sqlDataAdapter1;
        //存取数据库的主要类
        SqlCommand sqlCommand1;
        //SQL语句处理的类
        SqlConnection sqlConnection1;
        // 表示是否处于插入新记录的状态
        private bool bNewRecord = false;

        // 获取所有客户的ID
        private void GetCustomID()
{
SqlDataReader sdr ;
sqlConnection1.Open(); // 打开连接
sdr=sqlCommand1.ExecuteReader(CommandBehavior.CloseConnection);
cbxID.Items.Clear();
while( sdr.Read() ){
// 把客户ID插入到组合框控件中
cbxID.Items.Add( sdr.GetValue(0) );
}
sdr.Close(); // 关闭SqlDataReader对象和数据库连接
cbxID.SelectedIndex = 0;
}

        
        public Form1()
        {
            InitializeComponent();
        }

     private void Form1_Load(object sender, EventArgs e)
       {
       //SQL Server 登录机制
       //String  sConnString = "server=VS-LV;uid=sa;pwd=;database=Northwind";
       // Windows 安全登录机制
        String sConnString  = "Data Source=Highill;Initial Catalog=Northwind;Integrated Security=True";
        //SQL语句
        String sSQL = "SELECT * FROM Customers";
        //创建一个数据库连接对象
        sqlConnection1 = new System.Data.SqlClient.SqlConnection(sConnString ); 
        sqlCommand1 = new System.Data.SqlClient.SqlCommand(sSQL,sqlConnection1);     
        sqlCommand1.CommandText = "SELECT CustomerID FROM Customers ORDER BY CustomerID";  
       //创建一个SqlDataAdapter对象
        sqlDataAdapter1=new SqlDataAdapter(sSQL,sqlConnection1);
       // 创建一个DataSet对象
       DataSet dataSet1=new  DataSet();
        sqlDataAdapter1.Fill(dataSet1, "Customers");
        dataGridView1.DataSource = dataSet1.Tables["Customers"];
        GetCustomID();
        }

        private void cbxID_SelectedIndexChanged(object sender, EventArgs e)
        {
            // 创建SQL命令对象
            SqlCommand sqlcmd = new SqlCommand(
                "SELECT * FROM Customers WHERE CustomerID = @ID",
                sqlConnection1);
            // 设置参数
            sqlcmd.Parameters.AddWithValue("@ID", cbxID.Text);
            SqlDataReader sdr;
            sqlConnection1.Open();
            sdr = sqlcmd.ExecuteReader();
            if (sdr.Read())
            {
                // 使用不同的方式读取特定字段的值
                txtCompanyName.Text = sdr.GetString(1);
                txtContactName.Text = sdr["ContactName"].ToString();
                txtContactTitle.Text = sdr[3].ToString();
                txtAddress.Text = sdr.GetValue(4).ToString();
                txtCity.Text = sdr["City"].ToString();
                txtRegion.Text = sdr.GetValue(6).ToString();
                txtPostalCode.Text = sdr[7].ToString();
                txtCountry.Text = sdr[8].ToString();
                txtPhone.Text = sdr[9].ToString();
                txtFax.Text = sdr[10].ToString();
            }
            sdr.Close();
            sqlConnection1.Close();

        }

        private void btnPrev_Click(object sender, EventArgs e)
        {
            if (cbxID.SelectedIndex > 0)
                cbxID.SelectedIndex -= 1;

        }

        private void btnNext_Click(object sender, EventArgs e)
        {
            if (cbxID.SelectedIndex < cbxID.Items.Count - 1)
                cbxID.SelectedIndex += 1;

        }

        private void btnOrder_Click(object sender, EventArgs e)
        {
            FormOrders orders = new FormOrders();
            orders.CustomerID = cbxID.Text;
            orders.ShowDialog();

        }

        private void btnNew_Click(object sender, EventArgs e)
        {
            txtCompanyName.Text = "";
            txtContactName.Text = "";
            txtContactTitle.Text = "";
            txtAddress.Text = "";
            txtCity.Text = "";
            txtRegion.Text = "";
            txtPostalCode.Text = "";
            txtCountry.Text = "";
            txtPhone.Text = "";
            txtFax.Text = "";
            cbxID.DropDownStyle = ComboBoxStyle.DropDown;
            cbxID.Text = "";
            bNewRecord = true;

        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            SqlCommand sqlcmd = new SqlCommand(
                "DELETE FROM Customers WHERE CustomerID=@ID",
                sqlConnection1);
            sqlcmd.Parameters.AddWithValue("@ID", cbxID.Text);
            try
            {
                sqlConnection1.Open();
                int rowAffected = sqlcmd.ExecuteNonQuery();
                if (rowAffected == 1)
                    cbxID.Items.RemoveAt(cbxID.SelectedIndex);
            }
            catch (SqlException ex)
            {
                MessageBox.Show("删除错误:" + ex.Message, "出现错误",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                sqlConnection1.Close();
            }
            if (cbxID.SelectedIndex < cbxID.Items.Count - 1)
                cbxID.SelectedIndex += 1;

        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            string sqlStatement;
            // 根据是否正在添加新记录来建立适当的查询语句
            if (bNewRecord == true)
            {
                sqlStatement = "INSERT INTO Customers VALUES(" +
                    "'" + cbxID.Text + "'," +
                    "'" + txtCompanyName.Text + "'," +
                    "'" + txtContactName.Text + "'," +
                    "'" + txtContactTitle.Text + "'," +
                    "'" + txtAddress.Text + "'," +
                    "'" + txtCity.Text + "'," +
                    "'" + txtRegion.Text + "'," +
                    "'" + txtPostalCode.Text + "'," +
                    "'" + txtCountry.Text + "'," +
                    "'" + txtPhone.Text + "'," +
                    "'" + txtFax.Text + "')";
            }
            else
            {
                sqlStatement = "UPDATE Customers SET " +
                    "CompanyName='" + txtCompanyName.Text + "'," +
                    "ContactName='" + txtContactName.Text + "'," +
                    "ContactTitle='" + txtContactTitle.Text + "'," +
                    "Address='" + txtAddress.Text + "'," +
                    "City='" + txtCity.Text + "'," +
                    "Region='" + txtRegion.Text + "'," +
                    "PostalCode='" + txtPostalCode.Text + "'," +
                    "Country='" + txtCountry.Text + "'," +
                    "Phone='" + txtPhone.Text + "'," +
                    "Fax='" + txtFax.Text + "'" +
                    "WHERE CustomerID = '" + cbxID.Text + "'";
            }
            // 创建SQL命令
            SqlCommand sqlcmd = new SqlCommand(
                sqlStatement,
                sqlConnection1);
            try
            {
                sqlConnection1.Open();
                int rowAffected = sqlcmd.ExecuteNonQuery();
                if (rowAffected == 1)
                    cbxID.Items.Add(cbxID.Text);
            }
            catch (SqlException ex)
            {
                MessageBox.Show("更新错误:" + ex.Message, "出现错误",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                sqlConnection1.Close();
            }
            if (bNewRecord == true)
            {

                cbxID.DropDownStyle = ComboBoxStyle.DropDownList;
                bNewRecord = false;
                cbxID.SelectedIndex = cbxID.Items.Count - 1;
            }

        }
    }
}


修改更新差不多--前段时间试了试 你可以搜索下
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,