Results 1 to 7 of 7

Thread: A very noob question but need answers

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Posts
    232

    A very noob question but need answers

    Code:
    Data.OleDb.OleDbType.VarChar, 50, txtGroupName.Text
    Can someone tell me what does the 50 stands for?

  2. #2
    Hyperactive Member mrmojorisin's Avatar
    Join Date
    Oct 2007
    Location
    London Town Vocation: Garden Cricket Genuis
    Posts
    439

    Re: A very noob question but need answers

    If you re-type that line of code in vb .net, once you type the first comma, a small box should pop up telling you what is required after the comma and what it means!! E.g the first comma after VarChar.

  3. #3
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Re: A very noob question but need answers

    It's size, which you can read up on here: http://msdn.microsoft.com/en-us/libr...eter.size.aspx

    As above you could have read that within the IDE using the intellisense features.

    Anyhow when you setup and design a database, often you will put a maximum number of characters limit upon the fields, or columns of the database tables being designed. For instance a UK postcode maybe "SW12 1WS" - a maximum of 8 characters (this is an example, don't take that 8 for granted) so a PostCode database field you might setup with 8 as it's size, or maximum amount of characters to accept.

    If you then performed an INSERT into your database table with this field in, and specfied a value of 0123456789 for the PostCode field, the database engine will correctly determine from your table field's size property that this value isn't acceptable as being a valid post code, and throw an exception rather than saving the value/completing execution of the INSERT statement.
    Last edited by alex_read; Jun 27th, 2008 at 04:15 AM.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Posts
    232

    Re: A very noob question but need answers

    i am using visual studio, but it doesn't seem to pop out a small box. it only pops out for the varchar but as soon as i hit the first comma, nothing came out...

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2008
    Posts
    232

    Re: A very noob question but need answers

    it says 'Gets or sets the maximum size, in bytes, of the data within the column'

    In bytes, as in the range of values?
    If so, then how do you put for currency and integer? To any amount?

  6. #6
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Re: A very noob question but need answers

    I've expanded that previous answer to help explain a little further.

    Quite right that statement on it's own won't give you the valid syntax to produce an intellisense popup - I had imagined (as I guess Mojo did) that you had the full line of code rather than that shortened sample. In order to get the intellisense there you can enter: "Dim anOLEDBParameter as new OLEDBParameter("

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  7. #7
    Hyperactive Member mrmojorisin's Avatar
    Join Date
    Oct 2007
    Location
    London Town Vocation: Garden Cricket Genuis
    Posts
    439

    Re: A very noob question but need answers

    Quote Originally Posted by alex_read
    Quite right that statement on it's own won't give you the valid syntax to produce an intellisense popup - I had imagined (as I guess Mojo did) that you had the full line of code rather than that shortened sample. In order to get the intellisense there you can enter: "Dim anOLEDBParameter as new OLEDBParameter("
    Apologies, that should help you a bit more!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width