Click here to Skip to main content
15,902,634 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL Query, Unknown column 'p.prod_id' in 'on clause' Pin
jkirkerx7-Nov-13 8:49
professionaljkirkerx7-Nov-13 8:49 
GeneralRe: SQL Query, Unknown column 'p.prod_id' in 'on clause' Pin
Jörgen Andersson7-Nov-13 9:15
professionalJörgen Andersson7-Nov-13 9:15 
GeneralIt's pretty close, needs some more adjustments. Pin
jkirkerx7-Nov-13 13:57
professionaljkirkerx7-Nov-13 13:57 
Questionaccess procedure Pin
shabha1106-Nov-13 21:26
shabha1106-Nov-13 21:26 
AnswerRe: access procedure Pin
Mycroft Holmes6-Nov-13 21:52
professionalMycroft Holmes6-Nov-13 21:52 
QuestionOracle 10g connectivity issue with .net 2.0 website hosted on win 2008 server Pin
abhi17_66-Nov-13 4:19
abhi17_66-Nov-13 4:19 
AnswerRe: Oracle 10g connectivity issue with .net 2.0 website hosted on win 2008 server Pin
jschell6-Nov-13 8:08
jschell6-Nov-13 8:08 
GeneralRe: Oracle 10g connectivity issue with .net 2.0 website hosted on win 2008 server Pin
abhi17_66-Nov-13 15:45
abhi17_66-Nov-13 15:45 
GeneralRe: Oracle 10g connectivity issue with .net 2.0 website hosted on win 2008 server Pin
jschell7-Nov-13 9:16
jschell7-Nov-13 9:16 
QuestionHow to create directory in SQL with Space Pin
Samarjeet Singh@india6-Nov-13 0:47
Samarjeet Singh@india6-Nov-13 0:47 
AnswerRe: How to create directory in SQL with Space Pin
Chris Quinn6-Nov-13 1:08
Chris Quinn6-Nov-13 1:08 
GeneralRe: How to create directory in SQL with Space Pin
Samarjeet Singh@india6-Nov-13 1:22
Samarjeet Singh@india6-Nov-13 1:22 
QuestionRe: How to create directory in SQL with Space Pin
thatraja6-Nov-13 2:06
professionalthatraja6-Nov-13 2:06 
AnswerRe: How to create directory in SQL with Space Pin
Samarjeet Singh@india6-Nov-13 2:21
Samarjeet Singh@india6-Nov-13 2:21 
AnswerRe: How to create directory in SQL with Space Pin
Richard Deeming6-Nov-13 2:57
mveRichard Deeming6-Nov-13 2:57 
GeneralRe: How to create directory in SQL with Space Pin
Samarjeet Singh@india7-Nov-13 4:47
Samarjeet Singh@india7-Nov-13 4:47 
GeneralRe: How to create directory in SQL with Space Pin
Richard Deeming7-Nov-13 8:33
mveRichard Deeming7-Nov-13 8:33 
GeneralRe: How to create directory in SQL with Space Pin
Samarjeet Singh@india21-Nov-13 0:57
Samarjeet Singh@india21-Nov-13 0:57 
AnswerRe: How to create directory in SQL with Space Pin
jschell7-Nov-13 9:26
jschell7-Nov-13 9:26 
AnswerRe: How to create directory in SQL with Space Pin
Minghao Xue20-Nov-13 22:03
professionalMinghao Xue20-Nov-13 22:03 
GeneralRe: How to create directory in SQL with Space Pin
Samarjeet Singh@india21-Nov-13 0:57
Samarjeet Singh@india21-Nov-13 0:57 
QuestionSudden cast problem using executescalar Pin
Gennady Oster5-Nov-13 22:25
Gennady Oster5-Nov-13 22:25 
Hi !

Here is the snip of code in question:

C#
.......
                sql = "select " + picField + " from " + table + " where " + where;
                conn = new SqlConnection(connectionstring);
                byte[] picture = (byte[])ExecuteScalar(sql);  // Shows error
                Image source = Image.FromStream(new MemoryStream(picture));
                Image th = source.GetThumbnailImage(w, h, null, IntPtr.Zero);
.......
        public object ExecuteScalar(string strCommand)
    {
        object res=null;
        conn.Open();
        SqlCommand cmd = new SqlCommand(strCommand, conn);
        try
        {
            res = cmd.ExecuteScalar();
        }
        catch(Exception e)
        { res = e.Message; }
        finally
        {
            conn.Close();
        }
        return res;
    }


It worked like a sharm some time ago.
Code was not changed. The table definition also was not changed and field declaration is as follows:
[Picture_Image] [image] NOT NULL

But now I get error:
unable to cast object of type 'system.string' to type 'system.byte '
I suppose that something may be changed in the server and/or DB settings. But what ??

Can somebody please shed a light on this issue?

Thanks in advance.
Regards,
Gennady
My English is permanently under construction. Be patient !!

AnswerRe: Sudden cast problem using executescalar Pin
Richard Deeming6-Nov-13 1:22
mveRichard Deeming6-Nov-13 1:22 
GeneralRe: Sudden cast problem using executescalar Pin
Gennady Oster6-Nov-13 1:46
Gennady Oster6-Nov-13 1:46 
Questionhow can left join two table on multiple column??? Pin
mhd.sbt5-Nov-13 9:22
mhd.sbt5-Nov-13 9:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.