|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Dynamic SQL Error
I get an error when using a FbDataAdapter to fill a dataset. The code is just a duplicate of SqlDataAdapter code I've used for MSSQL. The error is:
Dynamic SQL Error SQL error code = -204 Table Unknown MasterName At line 1, column 15. Any ideas?? Greatly appreciative. This might be useful to someone: Code:
dbstr = "User=SYSDBA;Password=masterkey;Database=Masterdb.fdb;Datasource=localhost;Port=3050;"
dbstr &= "Dialect=3;Charset=NONE;Role=;Connection lifetime=15;Pooling=true;Packet Size=8192"
FBConn = New FbConnection(dbstr)
FBConn.Open()
FBDS.Clear()
FBAdapter = New FbDataAdapter("Select * From MasterName", FBConn)
FBAdapter.Fill(FBDS, "MasterName") <- Error on this line.
FBConn.Close()
|
|
#2
|
|||
|
|||
|
Dear all,
See which dialect you used for your database. If it was set for Dialect3 AND case-sensitve, you have to use double-quoatation marks around the table and fields' names. (Example) "select * from \"MyTable\"" Hope that this would be helpful to you. - JH |
|
#3
|
|||
|
|||
|
The dialect is set to 1, I changed it to 3 and attempted to change the code, but that was unsuccessful.
|
|
#4
|
|||
|
|||
|
If the dialect is set to 1, then your connection string also has "dialect = 1" instead of having "dialect = 3."
Try to run the same query statement from SQL editor to check if your statement is really valid. - JH |
|
#5
|
|||
|
|||
|
Actually, I changed the statement:
dbstr = "User=SYSDBA;Password=masterkey;Database=LAPTOP:Arrestdb.fdb;... and now I'm getting an error on the .Fill statement saying that the feature is not supported. Quick question, was I supposed to register the .DLL I downloaded, because I just referenced the .dll from where it was installed to?? |
|
#6
|
|||
|
|||
|
Hi,
Ok..... let me see if you configured correctly first. Please check the followings first. 1. .NET framework version (1.0 or 1.1) => there are two different versions of .NET data provider for FireBird and the one for 1.0 won't work on framework version 1.1. In this case, you will have a runtime error just like "~ not supported." 2. Make sure you add a reference to your project 3. Instead of using DataAdapter, try to use DataReader and see if it works. If you have any more questions or issues, FEEL FREE to post yours here. I will be more than happy to answer your questions as long as I have solutions to yours. Have a great afternoon!!!! - JH |
|
#7
|
|||
|
|||
|
Also, try to give a full path & database name if it is located in your local laptop or pc.
Just avoid using any computer name or identifier at this time. - JH |
|
#8
|
|||
|
|||
|
Well I greatly appreciate it.
I downloaded and installed the correct version, I'm running 1.1 and that's the provider I'm working with. I referenced the project from where it is installed, in the Firebird folder in Program Files. I didn't know if I had to register the .dlls. Yeah, I tried a datareader thinking it was just the fill command. But when I perform the executereader command, it gives me the same error: Feature not supported. If I make the statement look like: database=C:\WINNT\system32\Masterdb.fdb from database=LAPTOP:Masterdb.fdb I get the old error, table unknown. I even tried database=LAPTOP:C:\WINNT\system32\Masterdb.fdb. I know there has to be someone who got it to work in VB.net using the .Net provider. |
|
#9
|
|||
|
|||
|
< Your code: >
FBAdapter = New FbDataAdapter("Select * From MasterName", FBConn) < Change to: > FBAdapter = New FbDataAdapter("Select * From \"MasterName\"", FBConn) See you database if this table name is identical (case-sensitively). Normally, the table name is stored all UPPER CASE. You have to use the same case too..... Make sure database connection "open" method works fine too. Try to debug line by line by "Stepping into." |
|
#10
|
|||||
|
|||||
|
Quote:
That line of code does not compile. Tried that earlier. Quote:
Yes, they are identical in case. Quote:
Open statement executes without any hitches so I take it I'm connecting to the db correctly. Have you been able to connect to the firebird server?? What language are you using?? Again, I appreciate the time and assistance. |
|
#11
|
|||
|
|||
|
Yes,
I am using FB very heavily with MSSQL2000 server. Also, I am using C# not VB.NET. See how ASP.NET works with FB server at www.freemywork.com.... It is my asp.net sample site. - JH |
|
#12
|
|||
|
|||
|
Are you using the .Net provider provided by IBPhoenix?? I saw an OleDb provider in another post and was thinking about trying that to test.
I guess this is just one of the fallbacks in using new technology, not a lot of documentation or examples. I tried the IBPhoenix website but was unable to find anything. Is there anyplace where I might find some documentation?? |
|
#13
|
|||
|
|||
|
Yes, I am using the general .NET data provider posted on FireBird website.
I still suspect that the error regarding to "table not found" has something to do with case-sensitivity issue or double-quotation issue. I used to have the similar problem before.... Once you can finally run one statement through .NET provider, it will be like coping and pasting the block of source codes for handling database from that point. Surely, you will get it to work..... If you want, I will give you a partial source code of my sample asp.net page even though it was programmed in C#. - JH |
|
#14
|
|||
|
|||
|
Thank, I would appreciate that. You can send it to my email address, jconnor@cornerstonesystems.net. I'll be working on in through the evening and hopefully I'll figure it out.
|
|
#15
|
|||
|
|||
|
Finally...
I finally figured it out late last night and now am working with the server. jhlee24, I have you to thank, it was your reference to double quotes stated earlier that lead me down the right path. The only difference was that you posted the code for C# as: Select * \"MasterName\" to add double quotes to the table. Only thing is in VB.net, there are supposedly no "escape characters" so that syntax is not acceptable in the code. For anyone else using VB.net and are trying to connect to the Firebird server, here's the code:
Code:
Dim FBConn As FbConnection
Dim FBAdapter As FbDataAdapter
Dim FBCmd As FbCommand
Dim FBReader As FbDataReader
dbstr = "User=SYSDBA;Password=masterkey;Database=C:\WINNT\system32\Masterdb.fdb;DataSource=localhost;Port=305 0"
FBConn = New FbConnection(dbstr)
FBConn.Open()
FBDS.Clear()
FBCmd = New FbCommand("SELECT * FROM ""MstrCodes""", FBConn)
FBAdapter = New FbDataAdapter(FBCmd)
FBAdapter.Fill(FBDS, """MstrCodes""")
FBConn.Close()
FBDV = New DataView
FBDV.Table = FBDS.Tables("""MstrCodes""")
Since we can't use escape characters, you'll have to use two double quotes back to back to add double quotes to a string. |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Dynamic SQL Error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |