通过查询某个表中最大ID值,判断如果ID值不为空,也就是该表中已经有值,则根据该值得到下一个的值(如果有值有6为的,使用(6-length)得到需要在整数值前面加多少个“0”),如果ID值为空,则返回“000001”六位的下一个ID值
public string GetID()
{
object MaxId = null;
string id = "";
try
{
String sql = "select Max(Convert(int,ID)) from Table";
...
15
2012
04
获取某个表中的ID,得到下一个ID值
发布:郑德才博客 | 分类:工作之路 | 评论:0 | 浏览:
04
2012
04
一个用C#获取硬件信息的类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Management;
namespace GetPCInfo
{
class HardInfoClass
{
[DllImport("kernel32.dll")]
private static extern int GetVolumeInformation(
...
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Management;
namespace GetPCInfo
{
class HardInfoClass
{
[DllImport("kernel32.dll")]
private static extern int GetVolumeInformation(
...
发布:郑德才博客 | 分类:学习之路 | 评论:0 | 浏览:
28
2012
03
C# Winfrom中获取当前日期
获取当前时间,年,月,日,小时,分,秒,还有星期几
private void Main_F_Load(object sender, EventArgs e)
{
string[] weekdays = {"星期天","星期一","星期二","星期三","星期四","星期五","星期六" };
DateTime dt = DateTime.Now;
int year = dt.Year;
int mouth = dt.Month;
int day = dt.Day;
...
private void Main_F_Load(object sender, EventArgs e)
{
string[] weekdays = {"星期天","星期一","星期二","星期三","星期四","星期五","星期六" };
DateTime dt = DateTime.Now;
int year = dt.Year;
int mouth = dt.Month;
int day = dt.Day;
...
发布:郑德才博客 | 分类:学习之路 | 评论:0 | 浏览: