Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 urgent Pleas help

Author  Topic 

zez0
Starting Member

24 Posts

Posted - 2008-08-01 : 15:31:13
this is my web service


[WebMethod]
public bool SaveNews(string Title, string NewsDate, string Notes, string Time, string DateUpdate,byte[] image)
{
bool Test;
try
{
Conn = new OleDbConnection(connectionString);
query = "insert into News(NEWS_TITLE,NEWS_DATE,NEWS_DETAILS,NEWS_TIME,NEWS_DATE_UPDATE,IMAGE_PATH ) values ('" + Title + "','" + NewsDate + "','" + Notes + "','" + Time + "','" + DateUpdate + "'," + image + ")";
if (Conn.State != ConnectionState.Open)
Conn.Open();

cmd = new OleDbCommand(query, Conn);
int RES = cmd.ExecuteNonQuery();
if (RES < 0)
Test = false;
else
Test = true;
return Test;
}
catch (Exception Ex)
{
string message = Ex.Message;
return false;
}
finally
{
if (Conn.State != ConnectionState.Closed)
Conn.Close();
}
}


when i tray to insert the array of byte to the database error ocurre
can any body tell me what is the error
the data type of the IMAGE_PATH columen is BLOB

zezo

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2008-08-01 : 17:34:22
quote:
Originally posted by zez0
...can any body tell me what is the error...

We usually expect that you will tell us the error.



CODO ERGO SUM
Go to Top of Page

zez0
Starting Member

24 Posts

Posted - 2008-08-03 : 05:19:48
actually the error not appear to me but the web service return fals
so i think that the array of byte is the reason
(i want to now is this way to insert image to database wrong or right )

and thakyou very much

zezo
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-08-03 : 05:33:36
If you want to see the actual statement that goes through , open SQL Server Profiler , and attempt to capture the actual sql statement .
On the face of it , your statement look OK , but I can't tell I've seen the data types

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page

zez0
Starting Member

24 Posts

Posted - 2008-08-03 : 08:56:00
sorry but this problem i cant solve it
this is the data type of my table

zezo
Go to Top of Page

zez0
Starting Member

24 Posts

Posted - 2008-08-03 : 08:57:20
this is the data type of my tabel

NEWS_ID NUMBER(11)
NEWS_TITLE VARCHAR2(255)
NEWS_DATE VARCHAR2(55)
NEWS_DETAILS VARCHAR2(500)
NEWS_TIME VARCHAR2(55)
NEWS_DATE_UPDATE VARCHAR2(55)
IMAGE_PATH BLOB


zezo
Go to Top of Page

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2008-08-03 : 09:13:11
Jesus christ. SQL Injection central. And what's with storing date/times as chars?!? You're writing a complete bodge of system here. Take some programming lessons.
A quick hint- look up parameters & prepared statements. You may make some progress if you go down that path.
Go to Top of Page
   

- Advertisement -