Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > win32 odbc test script

Reply
Thread Tools

win32 odbc test script

 
 
joe
Guest
Posts: n/a
 
      06-27-2004
Hi i just wrote a little quick and dirty script to query odbc, i could not
find anything similar so i wrote this.

use Win32::ODBC;
print "Enter ODBC data source: ";
$myprompt = <STDIN>;
chop($myprompt);

my($db) = new Win32::ODBC("$myprompt");

while (true){
print "> ";
$myprompt = <STDIN>;
chop($myprompt);

if ($myprompt eq "quit"){
$db->Close();
exit;
}

$db->Sql("$myprompt");
my(@fields) = $db->FieldNames;

while ($db->FetchRow()) {
my(%data) = $db->DataHash();
foreach $field (sort @fields) {
$test = "$data{$field} ";
print "$test";
}
print "\n";

}
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xffc Thread 0x228 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-30-2006 03:16 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 1 03-24-2006 04:20 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-24-2006 02:22 PM
Dave Roth's site (Win32::AdminMisc, Win32::ODBC, etc.) not available. Jim Roberts Perl Misc 7 01-04-2006 02:36 PM
test test test test test test test Computer Support 2 07-02-2003 06:02 PM



Advertisments