Create connection to SQL from VB.net application - sql

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

Related

How to visually indicate Excel add-in "state"

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.

Lotusscript to insert a Subform into a Form programmatically

I am trying to deploy a Domino application in a possibly friendly way. I've got to the point where an agent imports Domino elements.
The functionality I'd like to provide is in a subform which I could export and import.
I still need to insert the SubForm in a specific location in an already existing Domino application.
I didn't find any API that could be helpful. Is there a way to access and modify the code of an already existing form directly?
DXL round-tripping of forms isn't perfect, so I wouldn't recommend using it in the way adminfd describes. You can, however, write C/C++ code that uses the Notes C API functions to scan through the CD records of a form and insert a subform reference. CD records are complex and you would probably want an expert to assist, to make sure you don't screw up your form by inserting your stuff in the wrong spot.

Create a log for all SQL action in Access

I'm currently having a problem at work.
Someone in the is modifying the table directly.
For example in my database I have school names like ETS. Well, today it was named Polytechnique.
What I'm trying to tell who did this modification either by his/her IP address or any other way. I currently have no ideas on how to proceed.
What I would like is just the beginning of a solution as to let me figure a part of it . I sadly don't have any ideas for the moment.
Thank you (I'm sorry for any errors english is not my first language. Also I could be mistaken for the tags)
(Welcome to SO. Sorry no one answered your question yet. It almost never takes this long.)
The short answer is: No. There is no way to find out who was modifying your tables directly. Access does not have any kind of automatic change logging, and you cannot create any logging procedures in VBA that will monitor manual changes to the tables.
One of the requirements for Access as a front-end is that you trust your end-users to not open tables and edit the data directly.
To prevent this in the future, here are some options:
Right click on your table to hide it. However, the user can just unhide it if they know it is there.
In your Access db is an option called "Display Navigation Option". Disabling this will hide the side-bar so the user can't see the tables. However, pressing F11 will still display them again. This can be easily googled, so I don't recommend it if your users are motivated.
Store your data in a SQL server and use connection strings (not direct links) to retrieve and store information.
Distribute your Access db via Sharepoint. The user will only be able to access the forms you specify and will have no direct access to the tables.
Consider another software package for your problems.

Access front end GUI

I have a small SQL database, I want to make a front end GUI for it. VERY basic kind of stuff that basically just allows the user to input data into the GUI which basically just inserts data into the tables from the SQL database. I have the SQL database loaded into Access. I split the database which i think I was supposed to do?? Not sure If i was wrong let me know.
I think I need to usa Visual basic to make the page? I tried tinkering around but I cant seem to find the right instructions online. I basically am just trying to make an Access front end with a GUI that has a couple text boxes that the user will input data into, which will then save into the data to the back end SQL.
Anyone have any direction then can help point me? or if im am just COMPLETELY wrong in doing this that would also be nice to know lol I just thought Ive seen this done somewhere.
First off, your linked tables in Access that link to SQLServer should have the globe icons like this picture:
This means they're linked to the server rather than imported in as a copy of the data. Be sure the tables have primary keys, too; if they're heap tables (ie, no clustered unique index) then the linked tables will be read-only, because Access doesn't know how to send an update query to SQLServer. You can test this by opening one of the linked tables and trying to change data; your cursor won't do anything if it's a read-only table.
To create a super-basic entry form linked to a table, click Insert>Form, then right-click the little square in the upper-left corner of the form and click Properties like this:
Select the table that you want this form to do edits on in the RecordSource property as shown below. You can click the "..." to make a query rather than a single table for the edits, like if you need to join tables, but this gets more complicated because Access gets particular about what queries are still editable and frequently treats the query as read-only if you don't meet all the requirements (for ex, union queries will be read-only):
After you set the RecordSource, click View>Field List and you'll see the fields from the table like this:
Highlight these fields and drag them to the form like this (the unique key fields like ProductID should usually be made invisible, especially if they're autonumber fields, b/c the database will set these, not the user):
Click View>Form View, and you've got yourself an entry form. Use the left-right arrows at the bottom to move through the records, and the asterisk button to create a new record.

Exandable table in Microsoft Word form

I'm creating a form in Microsoft Word that will be distributed to various people. One section on the form is a table where the user lists all the tests that he/she has taken and some relevant details about those tests. I don't know in advance how many tests a user has taken, although I can assume it is at least 1. I'd like to create a table that the user can add rows to for each test. Some of the columns will have form controls, one has a drop box, one has check boxes, one has a date picker. I'd like to be able to link these forms with Access once the user has completed them.
Is it possible to create a user expandable table that maintains the form controls in each column?
I am on a Linux machine right now so I can't test and debug code for you, but I have made tables in Word before where the size is decided at runtime (in fact, I did it from Excel, but that is off topic). However, I can tell you the general form is:
expression.Add(BeforeRow)
where expression returns a rows object, such as
ActiveDocument.Tables(1).Rows.Add(5)
Please see microsoft documentation of dealing with
tables:
http://msdn.microsoft.com/en-us/library/office/aa212430%28v=office.11%29.aspx
and rows:
http://msdn.microsoft.com/en-us/library/office/aa223081%28v=office.11%29.aspx
Also, from the VB editor in word, go to help and search "table object members," "row object members," etc.
If this hasn't been closed by tomorrow I will write something up. I will admit, in my experience Word VBA is a bit more temperamental than Excel VBA.