?? assetcategory.cs
字號:
using System;
using System.Data.SqlClient;
using System.Data;
namespace AssetManagement
{
/// <summary>
/// assetCategory 的摘要說明。
/// </summary>
public class assetCategory:Connection
{
private SqlConnection conn;
public assetCategory()
{
//
// TODO: 在此處添加構造函數邏輯
//
}
public void Open()
{
conn = new SqlConnection(this.getConnectionString);
conn.Open();
}
/*public SqlDataReader GetDataReader(string str)
{
SqlCommand com = new SqlCommand(str,conn);
SqlDataReader dr = com.ExecuteReader();
return dr;
}*/
public bool AddAssetCategory(string assetCategoryNo,string assetCategoryDescription)
{
SqlCommand cmd = new SqlCommand("AddAssetCategory",conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter AssetCategoryNo = new SqlParameter("@assetCategoryNo",SqlDbType.VarChar,10);
AssetCategoryNo.Value = assetCategoryNo;
cmd.Parameters.Add(AssetCategoryNo);
SqlParameter AssetCategoryDescription = new SqlParameter("@assetCategoryDescription",SqlDbType.VarChar,25);
AssetCategoryDescription.Value = assetCategoryDescription;
cmd.Parameters.Add(AssetCategoryDescription);
try
{
cmd.ExecuteNonQuery();
return true;
}
catch
{
return false;
}
}
public bool modifyAssetCategory(string assetCategoryNo,string assetCategoryDescription)
{
SqlCommand cmd = new SqlCommand("modifyAssetCategory",conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter AssetCategoryNo = new SqlParameter("@assetCategoryNo",SqlDbType.VarChar,10);
AssetCategoryNo.Value = assetCategoryNo;
cmd.Parameters.Add(AssetCategoryNo);
SqlParameter AssetCategoryDescription = new SqlParameter("@assetCategoryDescription",SqlDbType.VarChar,25);
AssetCategoryDescription.Value = assetCategoryDescription;
cmd.Parameters.Add(AssetCategoryDescription);
try
{
cmd.ExecuteNonQuery();
return true;
}
catch
{
return false;
}
}
public bool DeleteAssetCategory(string assetCategoryNo)
{
SqlCommand cmd = new SqlCommand(" DeleteAssetCategory",conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter AssetCategoryNo = new SqlParameter("@assetCategoryNo",SqlDbType.VarChar,10);
AssetCategoryNo.Value = assetCategoryNo;
cmd.Parameters.Add(AssetCategoryNo);
try
{
cmd.ExecuteNonQuery();
return true;
}
catch
{
return false;
}
}
public void Close()
{
conn.Close();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -