Have you ever tried to use mysql specif dll?

--
Flavio Henrique Moura Stakoviak
DGTAF - Secretária da Fazenda


On Mon, Dec 29, 2008 at 3:12 AM, nag <[email protected]> wrote:

>
> hi Flavio ,
> i tried with code wat you suggested above.but i'm getting following
> error.
>
> ERROR [23000] [MySQL][ODBC 3.51 Driver][mysqld-5.0.51a-community-nt]
> You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use
> near 'Title,'x-zip-compressed'MIMEType,'PK  \n\0\0\0\0\0ÏE
> ‰2\0\0\0\0\0\0\0\0\0\0\0\0 \' at line 1
>
> here is my code
> using (OdbcConnection myConnection = new OdbcConnection(connString))
>            {
>                //OdbcConnection myConnection = new OdbcConnection
> (connString);
>                const string SQL = "INSERT INTO PictureTable
> (Title,MIMEType,Image) VALUES (?Title,?MIMEType,?ImageData)";
>                OdbcCommand myCommand = new OdbcCommand(SQL,
> myConnection);
>
>                myCommand.Parameters.AddWithValue("?
> Title",TextBox1.Text.Trim());
>                myCommand.Parameters.AddWithValue("?MIMEType",
> MIMEType);
>                byte[] imageBytes = new byte
> [fileUpload1.PostedFile.InputStream.Length];
>                fileUpload1.PostedFile.InputStream.Read(imageBytes,
> 0,imageBytes.Length);
>                myCommand.Parameters.AddWithValue("?
> ImageData",imageBytes);
>
>                myConnection.Open();
>                myCommand.ExecuteNonQuery();
>                myConnection.Close();
>            }
>
>
>
> On Dec 28, 12:17 am, "Flavio Stakoviak" <[email protected]> wrote:
> > hi nag,
> >
> > try this codes, then confirm if your column on server if mediumblob type:
> >
> >        String connString = "Driver={MySQL ODBC 3.51
> > Driver};Server=mysql9.servername.com;Database=xyz;user
> > id=kv;password=kv";
> >        OdbcConnection myConnection = new OdbcConnection(connString);
> >            const string SQL = "INSERT INTO PictureTable
> > (Title,MIMEType,Image) VALUES (?Title, ?MIMEType, ?ImageData)";
> >
> >            OdbcCommand myCommand = new OdbcCommand(SQL,myConnection);
> >            myCommand.Parameters.AddWithValue("?Title",
> > TextBox1.Text.Trim());
> >            myCommand.Parameters.AddWithValue("?MIMEType", MIMEType);
> >            byte[] imageBytes = new byte
> > [fileUpload1.PostedFile.InputStream.Length];
> >            fileUpload1.PostedFile.InputStream.Read(imageBytes, 0,
> > imageBytes.Length);
> >            myCommand.Parameters.AddWithValue("?ImageData",
> > imageBytes);
> >            myConnection.Open();
> >            myCommand.ExecuteNonQuery();
> >            myConnection.Close();
> >
> > --
> > Flavio Henrique Moura Stakoviak
> > DGTAF - Secretária da Fazenda
>

Reply via email to