How to visually indicate Excel add-in "state" - vb.net

I have a VB.Net Excel add-in that queries a SQL Server database through several user-defined functions. There are also a couple of custom ribbon tabs, one of which presents the user with a form where they can select the appropriate server and database, and test to see that a connection can be made. Once a successful connection test has occurred, the customer would like the add-in to somehow indicate that the user is “connected”. Right now I’m playing around with a really small user form that contains no other controls, and has a .Text property of “CONNECTED” or “NOT CONNECTED” depending on the state of a connection test. This works, but isn't perfect since the form can be moved, and won’t follow Excel if the user chooses to move the application to a second monitor. I was wondering if anyone has worked with something similar before, or has other ideas.

Related

Excel, VB macro, MSCOMM and standard user

I have a device operated via Excel through com ports with MSComm32. Some macro linked to buttons on Excel forms used to make this device work properly. Up to these last days when it suddenly stopped working.
After some investigations, it seems there are some security considerations applied within Excel. The Excel file used up to now does not work anymore if Excel is runs as a standard user. An error message indicates the control cannot be created when trying to enter the creation mode, for example. But, if Excel is run as Administrator, then everything works fine.
Is there an easy way to fix this? For example granting access rights to standard user for the module MSComm32 OCX?
Thanks!

Create connection to SQL from VB.net application

I'm looking in to learning some coding and have a small project in mind to begin with,
To begin if anyone could point me in the direction of some good VB.net resources I would be very appreciative,
On a more specific note, I have a few particular questions:
I have a form with several text boxes, how would I go about using this form to establish a connection to an SQL database whereby the boxes on the form are used for (1, servername\instance. 2, database name. 3, sql login. 4,sql password) triggered by pressing the 'connect' button
I also have a form with a single text box, I would like to be able to query a specific table for records where based on primary key = contents of text box. On the form, I'd like to have other text boxes which link to columns on the table and return the value of the associated record.
As a development of the above, I would like to then have a button that writes any changes to the information back on to the record in SQL.
If anyone is able to offer any advise or insight on how I would begin going about this, that would be great.
I would much rather sources of how to learn to do the above that code if possible.
Do several thing or post actual code where you are stuck. it sounds like you will ask about how to put values on Database also. honestly want to say, if you research little bit what you want you will definitely get it. first google and then ask.
because you are in learning phase try to gather as much as knowledge rather copy paste code.
HINTS:
1) set your web.config with connection to sql
see: MSDN document
https://msdn.microsoft.com/en-us/library/ff400235.aspx
2) Then start coding UI
3) on UI you have different boxes, on each button click you should handle separately
search on:
How to open SQL Connection on button click
How to insert new records into a database
and lastly if you came across error then post your issue here.
Good Luck

Access is not showing the records I have entered through vb.net form

I am new in vb.net programming. Am facing a problem in database handling. Am using oledb to deal with database, which is MS Access in my project. I am dealing with queries at the time. Now the problem is that my queries are working well on vb form but are not affecting the actual database. For example, when am adding a record, it displays 'record added successfully', the message I have used for my conformation, but the actual database is not displaying the record I just entered and even got the above conformation message as well. I have checked query in sql editor too, its doing well. I have checked locals in vb debug mode, all are containing correct values.
Am not getting what's the reason behind that. Why it is displaying the success message but not modifying the actual database. Same is the case when am firing delete query, till now. I have not tried Update query yet.
Technology - Visual Basic.net with MS Access
Am using Access 2007 and Visual Studio 2013
Please Help by your suggestions
Do the controls on your form have the correct control source, i.e. the database table/query from and to which it should be reading and writing to?
Basically the problem was the gap between my understanding and .Net's working.
Here is the solution.
You can include database in two ways:
1.Either importing it directly to your project from the place, for example using drag and drop, or some other such method.
2.Or, by including it via using wizard.
But, the difference lies in connection string you use in your project, if you give absolute path of database, then you will directly see the alterations in database you have done using your application, even in testing and debugging mode via IDE.
connection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\xyz.accdb"
But if you are using connection string provide by wizard, for example,
connection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\xyz.accdb"
what the IDE will be doing is whenever you will be running project for debugging or testing, every time, it will copy the actual database, with its contents as well, in /bin/Debug folder. So, the changes you are performing will only be visible to that copy, not the actual file. So, if you want to verify with the database, like in our case, check the copy of database, which will be present in /bin/Debug folder. You will see the changes there. But, every time you run project for debugging, it will replace that copy with original one.
So, actually I was checking the original database file, not that copy, since the changes were only made to that copy. So that is why I was facing the above problem, not due to any programming fault.

How to see Tableau Custom SQL on server without downloading workbook?

Oftentimes I need to troubleshoot a workbook that another person at my company has created and published to our server. To troubleshoot, I need to see their connection details, specifically their Custom SQL, to understand what data they are using in their extract.
Is there any way to view this connection info (specifically their SQL code) when viewing the published workbook on the server (web) version?
I am an admin and I am able to download their workbook to my desktop version of tableau, then open it, then reconnect to the data, then look through the data connections they created, to see their SQL. But it's a really cumbersome process.
All I'm looking to do is, when looking at a published workbook, see the data connection details so that I can see the Custom SQL, without going through the process of downloading I described above.
You can get some details on the SQL statement by creating a performance recording.
From the Tableau Server Admin Guide:
Enable Performance Recordings:
Choose the Admin button in Tableau Server.
Choose Site.
Select a site.
Choose Edit.
In the Edit Site dialog box, select Allow Performance Recording.
Choose OK.
You start performance recording for a specific view by adding ?:record_performance=yes to
the url. For example:
http://server.site.com/views/Variety/BaseballStatistics?:record_performance=yes
Now, notice a new link at the top of your view called "Show Performance Recording".
Click this to open the generated performance workbook dashboard. Click on the bar chart and observe the SQL appear at the bottom of the view. Note, the SQL text will truncate after about 250 characters.
The admin guide suggests viewing the "Tableau Log" to find the full SQL statement.. I have looked at all the server side logs in C:\ProgramData\Tableau\Tableau Server\data\tabsvc\logs but cannot locate the SQL. (please reply if you know where to find this?)
You can also run a database trace to see the SQL that the database sees. For example, for MS SQL Server, run the Profiler tool, setup a default trace, and filter on "Application Name" = "Tableau Protocol Server 8.0" or similar.
I have version 8.1 and this is how I got around this problem. Tableau shows a 'Custom SQL Warning' when you open a workbook that contains the custom SQL. You can copy all the text in this message by simply Ctrl + C as this is any other Windows warning message. And then paste it your editor of choice to analyze it.
I do not know if this works on earlier versions.
I thought you could do this easily, and originally answered that you could, but I didn't pay close attention to your question. You can change some things about data connections without editing the workbook, including the ip address or name of the database server, but there doesn't appear to be a simple way to access custom sql without downloading the workbook.
Go to the Administrator page and select Data Connections.
You can enter some search criteria to filter the list of data connections shown (or not).
Find the workbook in question by scanning the second column -- you can sort the column if that helps.
Then select the corresponding data connection in the 4th column to see the details of the connection.
If it makes sense for the connection, you can also modify the connection directly at the server. This is really useful if you, say, need to move your enterprise database to a new IP address or change a database password, without downloading, modifying and republishing alot of workbooks.
An even better practice is to start using shared data connections hosted on Tableau server instead of having each workbook have its own local copy of connection and related info.

Switch an Access database between shared and exclusive mode?

I'm working on a program that needs to edit some objects in an Access database. It also runs a subprogram (long story) that tries to access the underlying JET database while Access still has it open via ODBC.
The problem is that as soon as I start editing Form objects using VBA - for example, using Application.LoadFromText - Access changes the database to exclusive mode. Exclusive mode itself is fine, and I know why it needs it. But I need to be able to switch back to "shared" mode afterwards so that I can run my subprogram.
I've observed that if you use the UI to open a Form in Design mode, Access switches the database to Exclusive. (You can confirm this by trying to open it from another computer.) But when you then close the form designer, Access immediately switches it back to shared mode, which is what I would hope for.
Is there a way to switch it back and forth myself using VBA / COM calls?
I know I can call Application.CloseCurrentDatabase() followed by OpenCurrentDatabase(), but that closes all the windows and upsets the UI, so it's not ideal.
Is splitting the database into a separate front-end with the forms/modules/etc. and back-end with the tables an option? That way if the front-end is locked, the back-end is still accessible. Access has a database splitting wizard for just that.
You might try .UserControl and .Visible. I use them to transfer control in automated processes.