Convert Ink Data
-
Hi I work on a ASP.net Webapplication where a user can interact with the Microsoft.Ink. I push a Windows.Forms.Control on the client. In this control i implement some methods. On the client i can use them by using javascript. I got the following problem. This is the Method in the UserControl that gives me a Base64String..
protected String SerializeInkData() { if(inko.Ink.Strokes.Count > 0) { byte[] inkDataBytes = inko.Ink.Save(PersistenceFormat.Gif); return Convert.ToBase64String(inkDataBytes); } return String.Empty; }
And then give it back..public string InkData { get { if (inko.Enabled) { return SerializeInkData(); } else { return String.Empty; } } }
Ok.. on the client I call the InkData Method by using javascript and save the Data into a hidden field. The client app is a asp.net site. While the site is post back to the server i read the content of the hidden field and try to save it in a database. The Column is from datatype IMAGE. But it don't work. I think that i have to convert the string of the hidden field into an byte[] Array.. But how?SqlConnection conn = new SqlConnection(connStr); conn.Open(); string img = this.BodyInkData.Value; //string tmp = this.byteLen.Value.ToString(); string insert = "INSERT INTO TestTable (Image) VALUES ('" + img + "')"; SqlCommand cmd = new SqlCommand(insert,conn); cmd.ExecuteNonQuery(); conn.Close();
How can I convert the string to a byte[] and save as BLOB into the Database? Greeting from Germany -- modified at 3:43 Wednesday 8th February, 2006