Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C#——·ÃÎÊSQL Server 2005¹«¹²Àà

ÏÂÃæÊÇÎÒ×ܽá³öÀ´µÄÒ»¸öÊý¾Ý¿â·ÃÎʹ«¹²À࣬»ùÓÚADO.NET£¬C#µÄ£¬ÆäÖУ¬ÒÔÖØÔØµÄ·½Ê½ÊµÏÖʹÓôæÊô¹ý³ÌµÄ½Ó¿ÚºÍ²»Óô洢¹ý³ÌµÄ½Ó¿Ú£¬ÈçÓв»Í×Çë´ó¼ÒÖ¸Õý£¬Ð»Ð»~
×÷Õߣºshinehoo
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace shinehoo.db
{
/// <summary>
/// ¶ÔÊý¾Ý¿âµÄһЩ¹«¹²²Ù×÷
/// </summary>
public class DBOperate
{
/// <summary>
/// ½¨Á¢Êý¾Ý¿âÁ¬½Ó
/// </summary>
/// <returns>·µ»ØSqlConnection¶ÔÏó</returns>
public static SqlConnection getConnection()
{
SqlConnection myCon;
try
{
string strSqlCon = "Data Source = SHINEHOO-PC\\SQLEXPRESS; Initial Catalog = ShineHoo_DB; Integrated Security = True";
//SqlConnectionÀàÓÃÀ´Á¬½ÓÊý¾Ý¿â
myCon = new SqlConnection(strSqlCon);
}
catch (Exception e)
{
throw e;
}
return myCon;
}
/// <summary>
/// Ö´ÐÐSqlCommandÃüÁî
/// </summary>
/// <param name="strSqlCommand">SQLÓï¾ä</param>
public static void getCommand(string strSqlCommand)
{
SqlConnection sqlcon = getConnection();
try
{
//SqlConnectionÀàµÄOpen()·½·¨ÓÃÀ´´ò¿ªÊý¾Ý¿âÁ¬½Ó
sqlcon.Open();
//ÉùÃ÷½«¶ÔÊý¾Ý¿âÖ´ÐÐÒ»¸öSQLÓï¾ä»ò´æ´¢¹ý³Ì
SqlCommand sqlcom = new SqlCommand(strSqlCommand, sqlcon);
//Ö´ÐÐSqlCommandÃüÁî
sqlcom.ExecuteNonQuery();
}
catch (Exception e)
{
throw e;
}
finally
{
//¹Ø±ÕÊý¾Ý¿âÁ¬½Ó
sqlcon.Close();
//sqlcon.Dispose();
}
}


Ïà¹ØÎĵµ£º

SQL ServerÖб¸·ÝÎļþÀÛ»ýµÄÎÊÌâ

Äã´´½¨µÄÿһ¸ö±¸·Ý¶¼ÊÇÒ»¸ö±¸·ÝÉ豸£¬¹ØÓÚËüµÄϸ½ÚÐÅÏ¢¶¼´æ´¢ÔÚmsdb..backupset±íÖС£Ò»¸ö±¸·ÝÉ豸¿ÉÒÔ±»´æ´¢ÔÚµ¥Ò»Îļþ£¬»òÊǶà¸öÎļþÖС£Í¬Ñù£¬Ò»¸öÎļþÒ²¿ÉÒÔ´æ´¢¶à¸ö±¸·ÝÉ豸¡£
ËùÒÔ£¬¼ÙÈçÄãÿ´Î±¸·Ý¶¼Ê¹ÓÃÏàͬµÄÎļþÃû£¬Îļþ¾Í»áÒ»Ö±Ôö³¤¡£Ò»¸öÆÕ±éµÄÎó½âÊÇ£ºÈç¹ûÄãÿ´ÎʹÓÃÏàͬµÄÎļþÃû£¬ÄǾɵı¸·ÝÉ豸¾Í»á±»¸²¸Ç¡ ......

C#ºǫ́µ÷ÓÃǰ̨javascriptµÄÎåÖÖ·½·¨


ÓÉÓÚÏîÄ¿ÐèÒª£¬Óõ½ÆäËûÏîÄ¿×éÓÃVC¿ª·¢µÄ×é¼þ£¬ÔÚwebºǫ́´úÂëÎÞ·¨·ÃÎÊÕâ¸ö×é¼þ£¬ËùÒÔÖ»ºÃͨ¹ýºǫ́µ÷ÓÃǰ̨µÄjavascript£¬´Ó¶ø²Ù×÷Õâ¸ö×é¼þ¡£ÔÚÍøÉÏÕÒÁËÕÒ£¬·¢ÏÖÓÐÈýÖÖ·½·¨¿ÉÒÔ·ÃÎʵ½Ç°Ì¨´úÂ룺
µÚÒ»ÖÖ£¬OnClientClick    (vs2003²»Ö§³ÖÕâ¸ö·½·¨)
<asp:Button ID="Button1" runat="se ......

c# ³ÌÐòÖ»ÔËÐÐÒ»´ÎµÄ´¦Àí·½·¨

·½·¨Ò»£º±éÀúÕýÔÚÓÐÏàͬÃû×ÖÔËÐеÄÀý³Ì
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace DHPSS.COM
{
/// <summary>
/// c#³ÌÐòÖ»ÔËÐÐÒ»´Î£¬C#Àý³ÌÖ»ÔËÐÐÒ»´Î
/// http://blog.csdn.net/nnsw ......

C#ÖнṹÓëÀàµÄÇø±ð

Ò»£®ÀàÓë½á¹¹µÄʾÀý±È½Ï£º
½á¹¹Ê¾Àý£º
public struct Person
{
string Name;
int height;
int weight
public bool overWeight()
{
//implement something
}
}
ÀàʾÀý£º
public class TestTime
{
int hours;
int minutes;
int seconds;
public void passtime()
{
//implementation ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ