🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.vbasic
Article #92647

Re: .NET problem z odczytem bazy danych

#92647
From: Robert Winkler
Date: Tue, 08 Nov 2005 06:10
42 lines
3025 bytes
>> Trudno powiedzieć nie znająć Exception które dostajesz w programie.
>> Umieść twój kod w sekcji Try-Catch
>> i umięść na grupie to co dostaniesz z metody ToString() obiektu Exception.
>
> ok wyskoczylo cos takiego:
> System.Data.OdbcException: ERROR [IM002][Microsoft][ODBC Driver Manager]Data
> source name not found and no defauld driver specified
> at System.Data.Odbc.OdbcConnection.Open()
> at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
> ConnectionState& originalState)
> at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> CommandBehavior behavior)
> at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord,
> Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
> behavior)
> at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
> at Project1.forma.form_load(Object eventSender, EventArgs eventArgs)


Tekst exception sugeruje iż w ConnetionString znajduje się błąd
Możliwe że nie masz na tych komputerach zdefiniowanego odpowiedniego DNS'a
Jeśli nie korzystasz z DNS'ów to możliwe że w twoim ConnectionString
brakuje sekcji Driver={Microsoft Access Driver (*.mdb)};
albo korzystasz z jakiejś narodowej wersji sterowników
"Microsoft Access-Treiber", "Driver do Microsoft Access" lub jakiegoś innego.
Sterowniki ODBC do Accessa nie są standardowo instalowane z niektórymi
systemami operacyjnymi może wiec brakuje ich na tych komputerach.

Moja propozycja to jeśli jest to możliwe zrezygnuj z ODBC
i skorzystaj z OledbConnection
połączenie dla tego obiektu może wyglądać następująco:
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=c:\somepath\myDb.mdb;"

Więcej na temat ConnectionStringów dla różnych baz znajdziesz na stronie
http://www.carlprothman.net/Default.aspx?tabid=81

-- 
____________
Robert Winkler
MVP 
Technical Details
Message-ID: <dkpffo$t75$1@atlantis.news.tpi.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!newsfeed.tpinternet.pl!nemesis.news.tpi.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
References: <dki6a3$5st$1@nemesis.news.tpi.pl> <68ea.00000212.436fa229@newsgate.onet.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!newsfeed.tpinternet.pl!nemesis.news.tpi.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
From: "Robert Winkler" <winkel@NOSPAMpoczta.fm>
Newsgroups: pl.comp.lang.vbasic
Subject: Re: .NET problem z odczytem bazy danych
Date: Tue, 8 Nov 2005 07:10:11 +0100
Organization: tp.internet - http://www.tpi.pl/
Lines: 43
Message-ID: <dkpffo$t75$1@atlantis.news.tpi.pl>
References: <dki6a3$5st$1@nemesis.news.tpi.pl> <68ea.00000212.436fa229@newsgate.onet.pl>
NNTP-Posting-Host: gw146.internetdsl.tpnet.pl
Mime-Version: 1.0
X-Trace: atlantis.news.tpi.pl 1131430200 29925 80.53.74.146 (8 Nov 2005 06:10:00 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Tue, 8 Nov 2005 06:10:00 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit