Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 4th, 2003, 08:55 AM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help connecting!!!

I am trying to connect to tables I created on SQL Server 7 using VB.net, but I can't I get the error: An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll Whenever I connect to the same database but to the northwind or pubs database that is fine, it is just when I create a database then try to connect to the tables within it. Here is my code:
Imports System.Data
Imports System.Data.OleDb
Imports System.DBNull

Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim objconnection As OleDbConnection = New OleDbConnection("Provider=SQLOLEDB;" & _
    "Datasource=Intranet;Initial Catalog=heads;" & _
    "integrated Security=SSPI;")
    Dim objdataadapter As OleDbDataAdapter
    Dim objdataset As DataSet
    Dim objdataview As DataView
    Dim objcurrencymanager As CurrencyManager

 objdataview = Nothing
        objdataset = New DataSet
        objconnection.Open()
        objdataadapter = New OleDbDataAdapter("SELECT quotekey FROM quotes", objconnection)
        objdataadapter.Fill(objdataset, "quotes")
        objdataview = New DataView(objdataset.Tables("quotes"))
        objcurrencymanager = CType(Me.BindingContext(objdataview), CurrencyManager)
        objconnection.Close()
        objdataset = Nothing

 txtID.DataBindings.Add("Text", objdataview, "quotekey")

Any help on this matter would be greatly appreciated.

Thanks

Reply With Quote
  #2 (permalink)  
Old November 4th, 2003, 09:58 AM
Ned Ned is offline
Authorized User
 
Join Date: Jun 2003
Location: Toronto, ON, Canada.
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this

Dim objconnection As OleDbConnection = New OleDbConnection("_
    "data source=Intranet;Initial Catalog=heads;" & _
    "integrated Security=SSPI;")

-ned
Reply With Quote
  #3 (permalink)  
Old November 4th, 2003, 11:04 AM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried that and it says I need a provider. I created a new table under the pubs database and still can't connect to it. If I try to connect to a default table under the pubs db it connects fine. I set my table up exactly as the default one. Any thoughts??

Reply With Quote
  #4 (permalink)  
Old November 4th, 2003, 12:35 PM
Friend of Wrox
Points: 2,101, Level: 18
Points: 2,101, Level: 18 Points: 2,101, Level: 18 Points: 2,101, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

This might be just plain silly but you might want to check your permissions in the properties of the table you're creating. I tried creating a table in Northwind and it did not inherit the same permissions as the other tables in Northwind.

Richard

Reply With Quote
  #5 (permalink)  
Old November 5th, 2003, 01:34 PM
Ned Ned is offline
Authorized User
 
Join Date: Jun 2003
Location: Toronto, ON, Canada.
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use this at the top of the module and then give a shot again
Imports System.Data.SqlClient

Dim objconnection As OleDbConnection = New OleDbConnection("_
    "database=dbname;Server=(local);" & _
    "integrated Security=SSPI;")

If you still get any problem then try to create a DSN, that will give you a clear picture why you having trouble connecting the database.

-ned
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting pages J_H Dreamweaver (all versions) 0 January 27th, 2007 07:09 PM
Connecting to MSAccess swatishah ADO.NET 3 January 19th, 2006 12:08 AM
Connecting to server Zodd Dreamweaver (all versions) 1 May 9th, 2005 02:51 PM
connecting to a database nehalw VB.NET 0 January 5th, 2005 05:59 AM
connecting to Autocad oni VB.NET 2002/2003 Basics 4 April 19th, 2004 10:47 AM



All times are GMT -4. The time now is 08:36 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.