½«Í¼Æ¬µÈÎļþ±£´æµ½sqliteÖУ¨c#£©
SqLite.netµÄdllΪSystem.Data.SQLite.dll£¬ÕâÖÖdll·ÖΪ32λ¡¢64λºÍÊÊÓÃÓÚcompactframeworkÈýÖÖ£¬ÔÚÒýÓÃʱҪעÒ⣬ѡÔñÕýÈ·µÄdll¡£
½«Òª±£´æÍ¼Æ¬µÄ×Ö¶ÎÀàÐÍÉèΪblob¡£´úÂëÈçÏ£º
private void savePicture£¨£©
{
using (SQLiteConnection cnn = new SQLiteConnection(dbPath))
{
cnn.Open();
using (SQLiteCommand cmd = cnn.CreateCommand())
{
//cmd.CommandText = "Create Table test(data Image)";
//cmd.ExecuteNonQuery();
cmd.CommandText = "insert into person values('12',@data,'14','13')";
SQLiteParameter para = new SQLiteParameter("@data", DbType.Binary);
string file = @"F:\Image\·É»ú.png";
FileStream fs = new FileStream(file, FileMode.Open);
//StreamUtil su = new StreamUtil();
//byte[] buffer = su.StreamToBytes(fs);
byte[] buffer = StreamUtil.ReadFully(fs);
fs.Close();
para.Value = buffer;
cmd.Parameters.Add(para);
cmd.ExecuteNonQuery();
}
}
}
ÆäÖÐStreamUtilΪ×Ô¶¨ÒåµÄÒ»¸öÀࣺ
public static class StreamUtil
{
const int BufferSize = 8192;
public static void CopyTo(Stream input,Stream output)
{
byte[] buffer = new byte[BufferSize];
int read;
while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, read);
}
}
public static byte[] ReadFully(Stream input)
{
using (MemoryStream tempStream = new MemoryStream())
{
CopyTo(input, tempStream);
return tempStream.ToArray();
}
}
}
²Î¿¼£ºhttp://www.
Ïà¹ØÎĵµ£º
ÀûÓÃ Page.RegisterStartupScript("", "<script language='javascript'> results();</script>");
»òÕßÊÇ Page.RegisterClient ......
ÔÚºÏ×÷¿ª·¢Ê±£¬C#ʱ³£ÐèÒªµ÷ÓÃC++DLL£¬µ±´«µÝ²ÎÊýʱʱ³£Óöµ½ÎÊÌ⣬ÓÈÆäÊÇ´«µÝºÍ·µ»Ø×Ö·û´®ÊÇ£¬ÏÖ×ܽáһϣ¬·ÖÏí¸ø´ó¼Ò£º
VC++ÖÐÖ÷Òª×Ö·û´®ÀàÐÍΪ£ºLPSTR,LPCSTR, LPCTSTR, string, CString, LPCWSTR, LPWSTRµÈ
µ«×ªÎªC#ÀàÐÍÈ´²»ÍêÈ«Ïàͬ¡£
Ö÷ÒªÓÐÈçϼ¸ÖÖת»»£º
½«stringתΪIntPtr£ºIntPtr System.Runtime.InteropServ ......
asp.netÓÐʱºò³£³£Ó÷þÎñÆ÷°ó¶¨¿Ø¼þÓÐЩÂé·³...
´úÂëÓÐЩÔÓ....
using System;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Web;
using System.Text;
namespace pub.mo
{
public class bind
{
p ......
ǰһÕó×Ö×öÏîÄ¿(ǶÈëʽlinux)£¬ÓÉÓÚÒª±£´æ´óÁ¿µÄÊý¾Ý£¬¶øÇÒ×Ҫ±£´æ30ÌìµÄʱ¼ä¡£±¾À´´òËã±£´æµ½ÎļþÖУ¬Ã¿´ÎÆô¶¯Ó¦ÓóÌÐòµÄʱºòÖØÐ½âÎöÒ»±é£¬¿ÉÊǵ±Êý¾ÝÁ¿ºÜ´óµÄʱºò£¬¾Í³öÏÖЧÂʵÄÎÊÌâÁË¡£ËùÒÔ×îºó»¹ÊÇ·ÅÆúÁËʹÓÃÎļþµÄ´òË㣬¾ö¶¨Ê¹ÓÃÊý¾Ý¿â´æÈ¡Êý¾Ý¡£
linuxϵÄÊý¾Ý¿âÒ²ºÜ¶à£¬ÓпªÔ´µÄ£¬Ò²ÓÐÊշѵġ£¶ÔÓÚÎÒÃÇÀ´Ëµ£¬¿Ï ......
SingletonģʽµÄʵÏÖ
SingletonģʽµÄʵÏÖ»ùÓÚÁ½¸öÒªµã£º
1£©²»Ö±½ÓÓÃÀàµÄ¹¹Ô캯Êý£¬¶øÁíÍâÌṩһ¸öPublicµÄ¾²Ì¬·½·¨À´¹¹ÔìÀàµÄʵÀý¡£Í¨³£Õâ¸ö·½·¨È¡ÃûΪInstance¡£Public±£Ö¤ÁËËüµÄÈ«¾Ö¿É¼ûÐÔ£¬¾²Ì¬·½·¨±£Ö¤Á˲»»á´´½¨³ö¶àÓàµÄʵÀý¡£
2£©½«ÀàµÄ¹¹Ô캯ÊýÉèΪPrivate£¬¼´½«¹¹Ô캯Êý"Òþ²Ø"ÆðÀ´£¬ÈÎºÎÆóͼʹÓù¹Ô캯Êý´´½¨Ê ......