Can't get rid of a deleted Settings reference in DataSet.Designer.vb - winforms

I had a connection string to a MS Access DB file, Foo.accdb, defined and used in my project. It was defined as a connection string Setting in the Settings section of my project properties. The program referenced the connection string setting and everything worked fine.
Then I decided to replace Foo.accdb with two different DB files, A.accdb and B.accdb each of which would be used under different circumstances. I added connection strings for them in Settings and removed the Setting definition for Foo.accdb connection string.
The name of my application is Foo and the name of the Foo.accdb connection string was FooConnectionString.
But now when I build the program both in debugger and for release I get the following error message:
'FooConnectionString' is not a member of 'Foo.My.MySettings'.
The offending reference, in file FooDataSet.Designer.vb, is:
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Private Sub InitConnection()
Me._connection = New Global.System.Data.OleDb.OleDbConnection
Me._connection.ConnectionString = Global.Foo.My.MySettings.Default.FooConnectionString
End Sub
What is going on here? FooConnectionString is not in any other file in the project directory nor in the My Project subdir. I completely got rid of it in my code and in my project properties yet it persists in FooDataSet.Designer.vb (whatever that is).
While researching this on the web I saw a recommendation to select the FooDataSet.xsd file, right click it and execute the "Run Custom Tool" option. I did this and it appears to rebuild FooDataSet.Designer.vb (the time stamp changes) but the problem persists.
I also tried removing the offending reference by manually editing FooDataSet.Designer.vb but that gave me some other error message.
Why is this old reference staying around and what can I do about it?
This is a standalone app. I'm using VS2008 Standard Ed., VB.Net 3.5
Thanks.

Open the FooDataSet XSD file in a text editor. Right click on dataset in the solution explorer and select "Open With..." and the select XML (text) Editor or open it outside the solution.
Look for the <Connections> tag near the top of the file. Remove the line that looks like this
<Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="FooConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="FooConnectionString(Settings)" ...

Related

msadox28.tlb is not a valid .Net assembly file while registering it

I am developing application with vb.net (2015) and MS Access database. I can work fine with existing database. I have now situation where I need to create database programmatically, for billing purpose. It is the situation where each folder will contain database for company/firm selection.
After searching on the internet / StackOverflow I learned about ADOX. Even got the ready code for it. I applied it in my coding.
Adding reference of Microsoft ADO extend 2.8 and 6.0
Created variable Adx as new Adox.catalog
Then finally wrote Adx.create(olejet provider conn string with data source)
In this step I get an error
COM Class not registered
So I tried to register msadox.dll and msadox28.tlb with regsvr32 and regasm but at that time I get another error:
msadox.dll get registered successfully but error gives in msadox28.tlb
Fail to load -file- becuase it is not a valid .net assembly file
Now I am stuck at this point.
My system is Windows 10 64 bit. I tried to target cpu x86, and any cpu but it didn't work. I got many questions and answer here but didn't understand it.
EDIT:
I tried following connection string and it worked, but it creates old 2000-2003 mdb file. i want to use new access file .accdb
String is :
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\VBProj\Testing\test.mdb;Jet OLEDB:Engine Type=5
EDIT : on 20/9/2021 - MON
First of all Thank you very much #Jimi, your suggestion to use ACE.16 and cleaning solution worked. Thanks a lot
I use the following steps to create MS Access database using ADOX in VB.NET:
Project Menu > Add Reference > COM Section > Select Microsoft ADO Ext. 6.0 for DLL and security
Write connection string at program entry point (form load/sub main) -> Provider=Microsoft.ACE.OLEDB.16.0;Data Source=D:\VBProj\Testing\test.accdb, assign it to variable connString
Declare adox catalog globally like Public gAdxCat As New ADOX.Catalog
Use its method gAdxCat.create(connString)
That's all - DONE
Again thanks to #jimi
This is the answer to my question (helped by #jimi)
following are the steps to create msaccess database using ADOX in VB.NET and error occurs mention in original questions.
1-Project Menu > Add Reference > COM Section > Select Microsoft ADO Ext. 6.0 for DLL and security (remove ref of 2.8)
2-write connection string at program entry point (form load/sub main) -> "Provider=Microsoft.ACE.OLEDB.16.0;Data Source=D:\VBProj\Testing\test.accdb" assign it to variable connString
3-declare adox catalog globally like Public gAdxCat As New ADOX.Catalog
4-User its method gAdxCat.create(connString)
5-Thats all DONE
again thanks to #jimi

Could not get type information for app.dataset

I've been stuck on this issue for some time now, i have connected to to an Azure database then created a dataset by adding a new data source.
But whenever i try to preview the data in one of the tables this error messeges
Could not get type information for app.dataset
The error message pops up whenever that dataset is created, and this error message pops up when i run this code
var q = (from ev in db.Events
where ev.Id != 0
select ev.Title).First().ToString();
string e = q;
tv.Text = e;
Sequence contains no elements
Any help is appreciated
I had the same kind of problem with Visual Studio 15 and a regular SQL server. The Connection string was stored in my settings file. I had copied the file from another project and made small adjustments to it.
Deleting the copied settings file and creating a fresh one solved the problem. Apparently some incorrect data was copied also, even tho the settings file looked just fine.

How can I deploy the .dna file from ExcelDna?

I am trying to create an Excel (2007) Add-in that will respond to PivotTable changes, using this code:
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Excel.Worksheet sh = this.Application.ActiveSheet;
sh.PivotTableUpdate += new
Excel.DocEvents_PivotTableUpdateEventHandler(sh_PivotTableUpdate);
}
void sh_PivotTableUpdate(Excel.PivotTable TargetPivotTable)
{
MessageBox.Show("sh_PivotTableUpdate event fired");
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
Once the .dll was created, deploying it/generating an .xll file became a challenge; I used this post for guidance there, and do now have an .xll file.
I was able to add this to the Excel spreadsheet (.xlsx file) that I want to respond to the code (via File > Excel Options > Add-Ins > Go... > Browse), but get this err msg on adding the .xll file:
I did see that there is a *.dna file here \packages\ExcelDna.AddIn.0.33.9\content\ExcelDna-Template.dna
...but making a copy of that file and changing the name of it to [projectName].dna (Excel2010AddInForRptRunner-AddIn.dna), and then copying it to the same location as the .xll file with the .xlsx file is not the solution (no pun intended). Changing the PivotTable manually does not fire the event/I see no "sh_PivotTableUpdate event fired" message.
The .dna file does reference the .dll like so:
<ExternalLibrary Path="Excel2010AddInForRptRunner.dll" LoadFromBytes="true" Pack="true" />
So what do I need to do to resolve the err msg I get and get the .xll file to be accepted by the spreadsheet so that its code will run and the PivotTableUpdate event handler is fired?
There are two issues that I see in your snippet:
The first is that you seem to have mixed the VSTO Office stuff with Excel-DNA (I see this from the ThisAddIn_... code, which relates to VSTO). These don't mix at all - you can't use Excel-DNA inside a VSTO add-in project. Any namespaces that start with Microsoft.Office.Tools... indicate there is a problem. This might happen is you start with an "Office Add-In" or "Excel Add-in" as your project type.
There is a also mess in your project related to the NuGet packages - somehow the output files are inside the package directory, or the package directory has been overwritten or changed somehow. You should not have to ever edit anything under packages\...
If everything is correct, then the files you are interested in will be found in bin\Debug and bin\Release under your project directory. Usually you can redistribute only the single ...-AddIn-packed.xll file (which you can also rename if you want to).
I suggest you make a new "Class Library" project (not an Office add-in or anything like that) and install the ExcelDna.AddIn package again. Then follow the instructions in the ReadMe file that pops up to make a simple add-in with a single UDF function, and check that this runs and can be debugged and deployed correctly.
After you have that working perfectly, you can incorporate access the COM object model into your add-in by following these two steps:
Add a reference to the Excel Interop assemblies (Microsoft.Office.Interop.Excel and Office), either directly via "Add Reference", or by installing the ExcelDna.Interop assembly from NuGet.
Get hold of the right Application root object by calling ExcelDnaUtil.Application. The object returned can be cast to a Microsoft.Office.Interop.Excel.Application and used to get to the whole COM object model from there, and hook up your event handlers etc.

Access VBA error after splitting database

I have an Access database was created, it's working perfectly. After successfully splitting the database to back and front end I shared the _be file in shared drive and front end file in my local, I tried to run the front end and I am getting error when macro is executing:
I even put the back and front end in my local machine but still I am getting the error, I tried to remove the macros but still getting errors since I am not the one developed this application.
Dim fdb As Database
Dim utab As Table, otab As Table
DBEngine.SystemDB = "System.mdw"
Set fdb = CurrentDb()
Set utab = fdb.OpenTable("Users")
Set otab = fdb.OpenTable("Organization")
After tracing the function findorg() I found this error
Item not found in the collection
For this line
Set utab = fdb.OpenTable("Users")
I tried to change the code to be
Set utab = fdb.Rescordsets("Users")
But still I am getting the same error.
Note that I am using back and front end, I have all my tables linked.
"Users" table is not linked in the database in which you are running this code. Link it again and check, check for all tables that should also be linked.
i was able to solve the issue by using DAO 3.6 object library, as i found that the current database application is using DAO 2.5, so i recompiled the application and fixed all errors. also i managed to rename the functions that's been called by macro, i found that in macro when i write calling function as findorg() will not work, but in function name i specify "findorg" between double quote, which run successfully.

I/O Error for file database.gdb. No such file or directory, but that's not the file I'm trying to open

I'm trying to create a connection to an Interbase ToGo database, at runtime, in a unit that does not have a form.
MyConnection := TSQLConnection.Create(nil);
strTestPath := TPath.Combine(TPath.GetDocumentsPath, 'ISHMAEL.GDB');
MyConnection.Params.Add('Database=' + strTestPath);
MyConnection.DriverName := 'IBToGo';
MyConnection.Params.Add('User_Name=SYSDBA');
MyConnection.Params.Add('Password=masterkey');
MyConnection.Open();
Everything seems fine as I step through, until I try and open the connection. The open raises an I/O error, saying that database.gdb isn't found. I called the database ISHMAEL, so is something else happening, or is the error message misleading?
Ideally, I'd like to get all of my database calls (and really, most if not all of the business logic) out of the forms and into some data access and business object units, but am having difficulty finding examples.
All of the examples and tutorials I have found focus on dropping controls on a form, and using visual live bindings.
Can this be done inside a non-form unit?
Thanks!

Resources