Results 1 to 12 of 12

Thread: Connecting Sql to Vb.net

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Posts
    73

    Connecting Sql to Vb.net

    If anyone could help me with this I would be very greatfull. I am new to vb.net and I am trying to get a combo box to read a field from my sql table. I am using my local server on my computer so I don't have a user name or password. All of the code that I have tried to use gives me a blue line underneath some of my statements saying it has not been declared. If someone could help me out I would be most greatfull!!!!!!!!!!!

  2. #2
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112
    imports system.data.sqlclient ???

  3. #3
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    Since you didn't post any code, it's pretty tough to say where it might be wrong.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Posts
    73
    This is what i used.

    Dim myconnection as sqlconnection
    Dim mycommand as sqlcommand
    Dim myDatagrid as datagrid

    I get blue lines underneath "myconnection, mycommand, and mydatagrid" saying that thier not declaired.

  5. #5
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112
    Dim myconnection as new sqlconnection

    also with everyone else.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Posts
    73
    When I use the Dim myconnection as new sqlconnection the blue line is under sqlconnection saying that its not defined?

  7. #7
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112
    imports system.data.sqlclient

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Posts
    73
    yeah but the imports has a blue line under it saying it must precede any declarations.

  9. #9
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112
    put it topmost

    imports blah
    public class
    .
    .
    .
    end class

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Posts
    73
    thanks

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Posts
    73
    I don't have a user name and password for my local sql, do I just leave that out of the code?

  12. #12
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112
    i don't know much about this thing but i think this connectionstring should take care of this
    Code:
    dim cn as new sqlconnection()
    cn.connectionstring="integrated security=true;initial catalog=northwind")
    that is, if your database to access is northwind...

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