Click here to Skip to main content
16,006,709 members
Home / Discussions / C#
   

C#

 
GeneralRe: Raw Image to Bmp Image Pin
Heath Stewart3-Mar-04 8:58
protectorHeath Stewart3-Mar-04 8:58 
QuestionHow to draw on nonclient area of a form ? Pin
Andres Coder3-Mar-04 5:11
Andres Coder3-Mar-04 5:11 
AnswerRe: How to draw on nonclient area of a form ? Pin
Andres Coder3-Mar-04 5:30
Andres Coder3-Mar-04 5:30 
AnswerRe: How to draw on nonclient area of a form ? Pin
Heath Stewart3-Mar-04 6:09
protectorHeath Stewart3-Mar-04 6:09 
GeneralRe: How to draw on nonclient area of a form ? Pin
Andres Coder3-Mar-04 7:01
Andres Coder3-Mar-04 7:01 
GeneralRe: How to draw on nonclient area of a form ? Pin
Heath Stewart3-Mar-04 8:40
protectorHeath Stewart3-Mar-04 8:40 
GeneralRe: How to draw on nonclient area of a form ? Pin
Andres Coder3-Mar-04 8:44
Andres Coder3-Mar-04 8:44 
GeneralConnecting to MySQL with ODBC Pin
sps-itsec463-Mar-04 3:12
sps-itsec463-Mar-04 3:12 
Hi guys,

I think it's a simple question: I connect to a MySQL database with OdbcDataAdapter and besides the data I want to get the schema of the database directly from the database, so I use something like this:
public DataSet GetData()
{
    // Create DataSet
    DataSet ds = new DataSet(datasetName);
    OdbcDataAdapter adapter = new OdbcDataAdapter();
    adapter.SelectCommand = GetSelectAllCmd();  // Generates Query: "SELECT * FROM " + tableName
 
    // Get schema from database
    adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
 
    // Rename table
    adapter.TableMappings.Add("Table", tableName);
 
    // Get data
    adapter.Fill(ds);
 
    // Do we have errors?
    if(ds.HasErrors)
        ds.RejectChanges();
    else
        ds.AcceptChanges();
 
    // Free resources
    adapter.Dispose();
 
    return ds;
}
Everything seems working fine, but the schema isn't transfered correctly. The MaxLength property of the DataColumn member has the value of the longest entry in the database. For example if there is a column called 'name' and the database has an entry like 'John' the MaxLength property is 4. But I specified the 'name' column to allow 100 chars while creating the table (... name VARCHAR(100) NOT NULL, ...).
 
Furthermore I'm not able to change the MaxLength property. The following has no effect:
ds.Tables[tableName].Columns["name"].MaxLength = 100;
 
So I'm not able to insert a name to the 'name' column that is longer than 4. I get the error "The value violates the MaxLength limit of this column". Many thanks in advance!!!

Regards, mYkel

P.S.: Sorry I also posted this in SQL/ADO/ADO.NET forum but perhaps it fits better here...
GeneralRe: Connecting to MySQL with ODBC Pin
Heath Stewart3-Mar-04 6:07
protectorHeath Stewart3-Mar-04 6:07 
GeneralRe: Connecting to MySQL with ODBC Pin
sps-itsec463-Mar-04 8:41
sps-itsec463-Mar-04 8:41 
GeneralMail samples Pin
jimaya3-Mar-04 2:25
jimaya3-Mar-04 2:25 
GeneralRe: Mail samples Pin
joan_fl3-Mar-04 5:24
joan_fl3-Mar-04 5:24 
QuestionGUI Unit Testing in C#? Pin
Chris Gruber3-Mar-04 1:59
Chris Gruber3-Mar-04 1:59 
GeneralAPI question Pin
neilxp2-Mar-04 22:43
neilxp2-Mar-04 22:43 
GeneralRe: API question Pin
Corinna John2-Mar-04 23:04
Corinna John2-Mar-04 23:04 
QuestionHow can I type cast an string as an htmlTable ? Pin
MasudM2-Mar-04 20:34
MasudM2-Mar-04 20:34 
AnswerRe: How can I type cast an string as an htmlTable ? Pin
Corinna John2-Mar-04 22:11
Corinna John2-Mar-04 22:11 
GeneralRe: How can I type cast an string as an htmlTable ? Pin
Heath Stewart3-Mar-04 6:00
protectorHeath Stewart3-Mar-04 6:00 
AnswerRe: How can I type cast an string as an htmlTable ? Pin
MasudM5-Mar-04 1:31
MasudM5-Mar-04 1:31 
QuestionHow To convert Xml to Html Pin
Inam2-Mar-04 18:01
Inam2-Mar-04 18:01 
AnswerRe: How To convert Xml to Html Pin
Hojtha Karlsson2-Mar-04 22:15
Hojtha Karlsson2-Mar-04 22:15 
GeneralClickety Pin
Mazdak3-Mar-04 5:30
Mazdak3-Mar-04 5:30 
AnswerRe: How To convert Xml to Html Pin
Heath Stewart3-Mar-04 3:59
protectorHeath Stewart3-Mar-04 3:59 
GeneralAbout Dispose method Pin
Andres Coder2-Mar-04 17:29
Andres Coder2-Mar-04 17:29 
GeneralRe: About Dispose method Pin
Meysam Mahfouzi2-Mar-04 18:13
Meysam Mahfouzi2-Mar-04 18:13 

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.