看看有什么用?
来源:互联网 发布:青岛特锐德软件开发 编辑:程序博客网 时间:2024/04/20 13:03
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace MySchoolDAL
{
public class ClassService
{
#region Private Members
//从配置文件中读取数据库连接字符串
private readonly string connString = ConfigurationManager.ConnectionStrings["MySchoolConnectionString"].ToString();
private readonly string dboOwner = ConfigurationManager.ConnectionStrings["DataBaseOwner"].ToString();
#endregion
#region Public Methods
/// <summary>
/// 根据班级名称得到班级ID
/// </summary>
/// <param name="className">班级名称</param>
/// <returns>班级ID</returns>
public int GetClassIDByClassName(string className)
{
int number = 0;
SqlConnection conn = new SqlConnection(connString);
SqlCommand objCommand = new SqlCommand(dboOwner + ".usp_SelectClassIDByClassName", conn);
objCommand.CommandType = CommandType.StoredProcedure;
objCommand.Parameters.Add("@ClassName", SqlDbType.NVarChar, 50).Value = className;
conn.Open();
SqlDataReader objReader = objCommand.ExecuteReader(CommandBehavior.CloseConnection);
if (objReader.Read())
number = Convert.ToInt32(objReader["ClassID"]);
objReader.Close();
objReader.Dispose();
conn.Close();
conn.Dispose();
return number;
}
/// <summary>
/// 增加班级信息
/// </summary>
/// <param name="dsClass">班级信息数据集</param>
public void AddClass(DataSet dsClass)
{
SqlConnection conn = new SqlConnection(connString);
SqlCommand objCommand = new SqlCommand(dboOwner + ".usp_InsertClass", conn);
objCommand.CommandType = CommandType.StoredProcedure;
objCommand.Parameters.Add("@ClassName", SqlDbType.NVarChar, 50).Value = dsClass.Tables["Class"].Rows[0]["ClassName"];
objCommand.Parameters.Add("@GradeID", SqlDbType.Int).Value = dsClass.Tables["Class"].Rows[0]["GradeID"];
conn.Open();
objCommand.ExecuteNonQuery();
conn.Close();
conn.Dispose();
}
#endregion
}
}
- 看看有什么用?
- 看看有什么效果
- 看看都有什么好东东?
- 先看看对方有什么打算
- 看看有什么大的区别?
- 冒泡排序,仔细看看有什么不同?
- SD卡用久了,会有很多文件夹出现,大家现在看看都有什么用
- 看看什么?
- 大家看看下面这个程序会有什么结果
- 看看Google公司都有什么牛人
- 看看C# and VB.NET 有什么不同:
- 看看Google公司都有什么牛人
- 看看Google公司都有什么牛人
- 帮我看看我的代码有什么问题
- 【zz】看看Google公司都有什么牛人?
- 求助:求大神帮忙,,,,看看代码有什么问题?
- 对字符串排序,大家看看有什么问题
- 大家帮我看看这个php语句有什么问题
- 2008年的最后一天
- 给你一个故事,希望你能喜欢这个故事并希望它能为你带来好运
- 程序员六大职业素养
- .Net 2.0对文件传输协议(FTP)操作(上传,下载,新建,删除,FTP间传送文件等)实现汇总
- 不平凡的2008
- 看看有什么用?
- Netinstall中文软件目录及文件名
- ObjectARX-学习笔记
- Microsoft Visual Studio 2008安装点滴!
- 第一次博客测试
- How to enable USB selective suspend and system wake in the UMDF driver for a USB device
- MapGuide 和 Google Map
- SQL存储过程分页算法研究(支持千万级)
- [经验总结]我的VIM配置文件