public static void TestConnection() { OpenFileDialog openFile = new OpenFileDialog(); openFile.Filter = "DB文件|*.db"; openFile.ShowDialog(); var dbFile = openFile.FileName; var DBRoot = new SqlDB(dbFile); var helper = DBRoot.CreateHelper(); string dbName = "TestImageDB"; //OpenFileDialog open = new OpenFileDialog(); //open.Filter = ""; //open.ShowDialog(); //var img = Image.FromFile(open.FileName); //var ms = new MemoryStream(); //img.Save(ms, System.Drawing.Imaging.ImageFormat.Png); //var buffer = new byte[ms.Length]; //ms.Position = 0; //ms.Read(buffer, 0, buffer.Length); //savePicture(DBRoot.SQLiteConnection, buffer, dbName); //var str = Convert.ToBase64String(buffer); //helper.ExecuteQuery(string.Format("insert into {0} values('6','Ming','{1}')", dbName, str)); var reader = helper.ExecuteQuery(string.Format("select * from {0} where ID != 0", dbName)); if (reader.Read()) { //int x = reader.GetOrdinal("data"); //int size = 50 * 1024 * 1024; //var buffer = new byte[size]; //var blod = reader.GetBytes(x, 0, buffer, 0, size); //var bda = new byte[blod]; //Array.Copy(buffer, bda, blod); ////buffer.CopyTo(bda, 0); //File.WriteAllBytes("dlImag33333333e.png", bda); //var blod = reader.GetString(x); //var blod = reader.GetBlob(x, false); //var boldStr = blod.ToString(); //var pngBD = Convert.FromBase64String(blod); //File.WriteAllBytes("dlImage.png", pngBD); //int x = reader.get } //File.WriteAllText("img", str); //var bs = File.ReadAllText("img"); //var pngBD = Convert.FromBase64String(bs); //File.WriteAllBytes("new.png", pngBD); }