New topic: 

ODBC Pluggin with Text file

<http://forums.realsoftware.com/viewtopic.php?t=25787>

       Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic         Author  
Message       EAGAMEZ           Post subject: ODBC Pluggin with Text 
filePosted: Fri Dec 26, 2008 5:54 pm                        
Joined: Fri Dec 09, 2005 12:46 pm
Posts: 8
Location: Bogotá-Colombia              Hi:

Anyone know the correct code to connect to text file by odbc plugin without 
dsn..? 

I' triying to run the process using rb 2008 r5.1 but one warning is showed with 
the fololwing message:

"C:\Documents and Settings\My Project\Data.txt is not valid path. Make sure 
that the path name is spelled correctly and that you are connected to the 
server on wich file resides."

After this message an open dialog is showed in order to choice the file and 
after this step, the code work. Any idea in order to dissable or not to show 
any more the message..?

This one is my code:

  dim db as ODBCDatabase
  dim rs as RecordSet
  dim a as String
  
  
  db=new ODBCDatabase
  a=SpecialFolder.CurrentWorkingDirectory.AbsolutePath + "Data.txt"
  db.DataSource="Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + a + 
";Extensions=asc,csv,tab,txt;"
  
  
  
  if db.Connect then
  
  MsgBox "Connect!"
  
  rs=db.SQLSelect ("select * from Data.txt")
  
  if rs<>Nil then
  
  do until rs.EOF
    
    MsgBox rs.IdxField(1).StringValue
    rs.MoveNext
    
  loop
  
  else
  
  MsgBox "not data"
  
  end if
  
  
  else
  
  MsgBox db.ErrorMessage
  
  end if



Thank you for your comments.   
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]     
-- 
Over 900 classes with 18000 functions in one REALbasic plug-in. 
The Monkeybread Software Realbasic Plugin v8.1. 

&lt;http://www.monkeybreadsoftware.de/realbasic/plugins.shtml&gt;

[email protected]

Reply via email to