C#¹ØÓÚsqlserverÖжÁÈ¡imageÀàÐÍ
½ñÌìÔÚÍøÉÏÕÒÁËÐí¾Ã¹ØÓÚsqlserverÖд洢imageÀàÐͺͶÁÈ¡imageµÄ·½·¨£¬¿ÉÊǶ¼ÊÇÄÇôһµã£¬¹ÊÔÚ´ËÂÞÁÐһϣ¬Ï£Íû¿ÉÒÔ°ïÖú´ó¼Ò¡£
Ê×ÏÈÊǹØÓÚdataGridViewµÄ°ó¶¨¡£´úÂë¼ûÏÂ
private void button_show_Click(object sender, EventArgs e)
{
string sqlText = "server=localhost;initial catalog=Test; integrated security=true";
string sqlstr="select * from tast";
SqlConnection conn=new SqlConnection (sqlText);
conn.Open();
SqlCommand comm = new SqlCommand(sqlstr, conn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = comm;
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
conn.Close();
}
ÏÂÃæÊDzåÈëͼÏñµ½Êý¾Ý¿â£¬´úÂëÈçÏ£º
private void button_connect_Click(object sender, EventArgs e)
{
string sqlText = "server=localhost;initial catalog=Test; integrated security=true";
string sqlstr = "insert into tast(photo) values(@image) ";
SqlConnection conn = new SqlConnection(sqlText);
conn.Open();
SqlCommand comm = new SqlCommand(sqlstr, conn);
comm.Parameters.Add("@image", SqlDbType.Image).Value = GetPhoto("DSC_6126.JPG");
comm.ExecuteNonQuery();
conn.Close();
}
public byte[] GetPhoto(string str1)
{
string str = str1;
FileStream file = new FileStream(str, FileMode.Open, FileAccess.Read);
byte[]photo=new byte[file.Length];
file.Read(photo,0,photo.Length);
file.Close();
return photo;
}
ÏÂÃæ¾ÍÊǶÁȡͼƬÁË
private void button_showimg_Click(object sender, EventArgs e)
{
string sqlText = "server=localhost;initial catalog=Test; integrated security=true";
string sqlstr = "select *from tast where whf=1";
SqlConnection conn = new Sql
Ïà¹ØÎĵµ£º
//Ìæ»»ËùÓÐ
Regex reg = new Regex(@"(?is)</?a\b[^>]*>(?:(?!</?a).)*</a>");
string result = reg.Replace(yourStr, "");
//±£Áôwww.abc.comÁ´½Ó
Regex reg = new Regex(@"(?is)</?a\b.*?href=(['""]?)(?!(?:http://)?www\.abc\.com)[^'""\s>]+\1[^>]*>(?<text>(?:(?!</?a).) ......
bcpÃüÁîÊÇSQL ServerÌṩµÄÒ»¸ö¿ì½ÝµÄÊý¾Ýµ¼Èëµ¼³ö¹¤¾ß¡£Ê¹ÓÃËü²»ÐèÒªÆô¶¯ÈκÎͼÐιÜÀí¹¤¾ß¾ÍÄÜÒÔ¸ßЧµÄ·½Ê½µ¼Èëµ¼³öÊý¾Ý¡£bcpÊÇSQL ServerÖиºÔðµ¼Èëµ¼³öÊý¾ÝµÄÒ»¸öÃüÁîÐй¤¾ß£¬ËüÊÇ»ùÓÚDB-LibraryµÄ£¬²¢ÇÒÄÜÒÔ²¢Ðеķ½Ê½¸ßЧµØµ¼Èëµ¼³ö´óÅúÁ¿µÄÊý¾Ý¡£bcp¿ÉÒÔ½«Êý¾Ý¿âµÄ±í»òÊÓͼֱ½Óµ¼³ö£¬Ò²ÄÜͨ¹ýSELECT fromÓï¾ä¶Ô±í»òÊÓ ......
C#ÖжÔbaseµÄ½âÊÍ(Òý×ÔMSDN):
base ¹Ø¼ü×ÖÓÃÓÚ´ÓÅÉÉúÀàÖзÃÎÊ»ùÀàµÄ³ÉÔ±£º
µ÷ÓûùÀàÉÏÒѱ»ÆäËû·½·¨ÖØдµÄ·½·¨¡£
Ö¸¶¨´´½¨ÅÉÉúÀàʵÀýʱӦµ÷ÓõĻùÀ๹Ô캯Êý¡£
»ùÀà·ÃÎÊÖ»ÄÜÔÚ¹¹Ô캯Êý¡¢ÊµÀý·½·¨»òʵÀýÊôÐÔ·ÃÎÊÆ÷ÖнøÐС£
´Ó¾²Ì¬·½·¨ÖÐʹÓà base ¹Ø¼ü×ÖÊÇ´íÎóµÄ¡£
ÔÚ±¾ÀýÖУ¬»ùÀà Person ºÍÅÉÉúÀà Employee ¶¼ÓÐÒ»¸ö ......
ÏÂÎçÐèÒªÅäÖñ¾»ú°²×°µÄmssqlÊý¾Ý¿âÄܹ»ÔÚÔ¶³Ì·ÃÎÊ£¬ÔÚÍøÉÏËÑË÷µÄ·½·¨£ºhttp://weste.net/2009/5-20/21244518910.html
°´ÕÕÕâ¸ö²½ÖèÒ»²½Ò»²½ÅäÖÃÏÂȥȴ·¢ÏÖÈÔÈ»²»ÄÜ·ÃÎÊ¡£Èç¹ûÅäÖÃprotocolµÄʱºòlisten all ÉèÖÃΪno£¬ÖØÆômssql·þÎñϵͳ»áÌáʾmssql·þÎñ×Ô¶¯Í£Ö¹£»Èç¹ûÉèÖÃΪyes¿ÉÒÔÆô¶¯È´ÔÚnetstatÁбíÖÐÎÞ·¨¼ì²éµ½¶Ô1433¶ ......