[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Can't read BLOB fields from MySQL using ODBC.NET

Jim

9/4/2002 5:04:00 PM

This is in fact terrible. As it has stalled me completely.. :o\

I've tried both OdbcDataAdapter and OdbcDataReader. Every other type can be
read except BLOBs.. Is that really too much to ask? ;o)

What I want is just to be able to have text fields longer than 255 chars..
There really must be a way to fix this problem or ODBC.NET would be
completely useless.. :o\

And I have to use ODBC.NET with MySQL so the solution can't be changing
those..

Hope someone can help here.. ;) (oh and I don't wan't to split the text up
in a lot of VARCHAR(255)s...lol)



6 Answers

laled

9/5/2002 1:51:00 AM

0

You should be able to read large text fields without any
problems. Perhaps if you post a snippet of code showing
exactly how you are trying to read them, we might be able
to point out your problem.

laled

This posting is provided "AS IS" with no warranties, and
confers no rights.


>-----Original Message-----
>This is in fact terrible. As it has stalled me
completely.. :o\
>
>I've tried both OdbcDataAdapter and OdbcDataReader.
Every other type can be
>read except BLOBs.. Is that really too much to ask? ;o)
>
>What I want is just to be able to have text fields
longer than 255 chars..
>There really must be a way to fix this problem or
ODBC.NET would be
>completely useless.. :o\
>
>And I have to use ODBC.NET with MySQL so the solution
can't be changing
>those..
>
>Hope someone can help here.. ;) (oh and I don't wan't
to split the text up
>in a lot of VARCHAR(255)s...lol)
>
>
>
>.
>

Chirag Gupta

9/5/2002 3:57:00 AM

0

I have never tried that. But this might help you.

I was wondering if you could use native mysql driver
rather than ODBC. The site to download is :-

http://www.einfodesigns.com/pro...


>-----Original Message-----
>This is in fact terrible. As it has stalled me
completely.. :o\
>
>I've tried both OdbcDataAdapter and OdbcDataReader. Every
other type can be
>read except BLOBs.. Is that really too much to ask? ;o)
>
>What I want is just to be able to have text fields longer
than 255 chars..
>There really must be a way to fix this problem or
ODBC.NET would be
>completely useless.. :o\
>
>And I have to use ODBC.NET with MySQL so the solution
can't be changing
>those..
>
>Hope someone can help here.. ;) (oh and I don't wan't
to split the text up
>in a lot of VARCHAR(255)s...lol)
>
>
>
>.
>

Jim

9/5/2002 6:20:00 PM

0

ok.. here's the code in two different ways:
Both return System.Byte[] instead of the string I'd expect. It works with
all other types except BLOBs..

dbConn = new
OdbcConnection("Driver={MySQL};Server=localhost;option=16834;Database=xxx;Ui
d=xxx;Pwd=xxx;");

OdbcDataReader drComment;

OdbcCommand cComment = new OdbcCommand("SELECT comment FROM matchcomment
WHERE id="+Request.QueryString["id"],dbConn);

dbConn.Open();

drComment = cComment.ExecuteReader();

while(drComment.Read())

{

TextBoxContent.Text = drComment["comment"].ToString();

}

drComment.Close();

dbConn.Close();



-------------------------------

And here's another way I tried..

OdbcDataAdapter daComment = new OdbcDataAdapter("SELECT comment FROM
matchcomment WHERE id="+Request.QueryString["id"],dbConn);

DataSet dsComment = new DataSet();

daComment.Fill(dsComment,"comment");





"laled" <laled@nospam.microsoft.com> wrote in message
news:c41601c25476$516123f0$35ef2ecf@TKMSFTNGXA11...
> You should be able to read large text fields without any
> problems. Perhaps if you post a snippet of code showing
> exactly how you are trying to read them, we might be able
> to point out your problem.
>
> laled
>
> This posting is provided "AS IS" with no warranties, and
> confers no rights.
>
>
> >-----Original Message-----
> >This is in fact terrible. As it has stalled me
> completely.. :o\
> >
> >I've tried both OdbcDataAdapter and OdbcDataReader.
> Every other type can be
> >read except BLOBs.. Is that really too much to ask? ;o)
> >
> >What I want is just to be able to have text fields
> longer than 255 chars..
> >There really must be a way to fix this problem or
> ODBC.NET would be
> >completely useless.. :o\
> >
> >And I have to use ODBC.NET with MySQL so the solution
> can't be changing
> >those..
> >
> >Hope someone can help here.. ;) (oh and I don't wan't
> to split the text up
> >in a lot of VARCHAR(255)s...lol)
> >
> >
> >
> >.
> >


Jim

9/5/2002 6:22:00 PM

0

No.. unfortunally I don't have the possibility to change ODBC.NET on the
hosting server.. :\

"Chirag Gupta" <Chiraggupta@hotmail.com> wrote in message
news:d6d801c25488$08ab1370$a4e62ecf@tkmsftngxa06...
> I have never tried that. But this might help you.
>
> I was wondering if you could use native mysql driver
> rather than ODBC. The site to download is :-
>
> http://www.einfodesigns.com/pro...
>
>
> >-----Original Message-----
> >This is in fact terrible. As it has stalled me
> completely.. :o\
> >
> >I've tried both OdbcDataAdapter and OdbcDataReader. Every
> other type can be
> >read except BLOBs.. Is that really too much to ask? ;o)
> >
> >What I want is just to be able to have text fields longer
> than 255 chars..
> >There really must be a way to fix this problem or
> ODBC.NET would be
> >completely useless.. :o\
> >
> >And I have to use ODBC.NET with MySQL so the solution
> can't be changing
> >those..
> >
> >Hope someone can help here.. ;) (oh and I don't wan't
> to split the text up
> >in a lot of VARCHAR(255)s...lol)
> >
> >
> >
> >.
> >


Fredrick Bartlett

9/6/2002 2:55:00 AM

0

Hmmm, I have MySQL text fields and I am successfully using them.

"Comment" is a MySQL Text field
string c="";
while(Dr.Read()){
if(!Dr.IsDBNull(Dr.GetOrdinal("Comment"))){ //you should always check for
null
c = Dr.GetString(Dr.GetOrdinal("Comment"));
}else{
c = "";
}
}


"Tom" <no@way.com> wrote in message news:#3wjTzCVCHA.1648@tkmsftngp08...
> This is in fact terrible. As it has stalled me completely.. :o\
>
> I've tried both OdbcDataAdapter and OdbcDataReader. Every other type can
be
> read except BLOBs.. Is that really too much to ask? ;o)
>
> What I want is just to be able to have text fields longer than 255 chars..
> There really must be a way to fix this problem or ODBC.NET would be
> completely useless.. :o\
>
> And I have to use ODBC.NET with MySQL so the solution can't be changing
> those..
>
> Hope someone can help here.. ;) (oh and I don't wan't to split the text
up
> in a lot of VARCHAR(255)s...lol)
>
>
>


Jim

9/6/2002 4:41:00 PM

0

Maybe I should have tried this myself first..lol
But when you said that text fields work I tried changing the field from BLOB
to TEXT. And now it works ;)

However I still don't know what's wrong with using BLOBs for text. Anyone
knows?
According to the MySQL manual there shouldn't be much difference. It says :
"In other words, a TEXT is a case-insensitive BLOB."..

btw.. no need to check for null as the field cant be null ;)


"Fredrick Bartlett" <rick_bartlett@WeDoNET.net> wrote in message
news:eVN#whUVCHA.1944@tkmsftngp10...
> Hmmm, I have MySQL text fields and I am successfully using them.
>
> "Comment" is a MySQL Text field
> string c="";
> while(Dr.Read()){
> if(!Dr.IsDBNull(Dr.GetOrdinal("Comment"))){ //you should always check
for
> null
> c = Dr.GetString(Dr.GetOrdinal("Comment"));
> }else{
> c = "";
> }
> }
>
>
> "Tom" <no@way.com> wrote in message news:#3wjTzCVCHA.1648@tkmsftngp08...
> > This is in fact terrible. As it has stalled me completely.. :o\
> >
> > I've tried both OdbcDataAdapter and OdbcDataReader. Every other type can
> be
> > read except BLOBs.. Is that really too much to ask? ;o)
> >
> > What I want is just to be able to have text fields longer than 255
chars..
> > There really must be a way to fix this problem or ODBC.NET would be
> > completely useless.. :o\
> >
> > And I have to use ODBC.NET with MySQL so the solution can't be changing
> > those..
> >
> > Hope someone can help here.. ;) (oh and I don't wan't to split the
text
> up
> > in a lot of VARCHAR(255)s...lol)
> >
> >
> >
>
>