ADO - Best Practices When Using Tableadapters, Sql Connection Strings

May 2, 2010

I have read and worked through all of the examples in the book "ADO.NET 2.O", but there is so much there with so many ways to handle data, I am having difficulty translating the examples into my own real life application. I am confused about creating runtime connection strings, connection strings in my app.config file, connection strings in the properties for a sql connection control, etc.

I have a midichildform with a datagridview control, and I use a table adapter to edit and update the SQL Server 2005 Express edition database. There is no problem there. However, I also have a button control that I want to use to "process" the data that has been updated with the table adapter. I want to open the updated table, read each record on at a time, manipulate the data and add a records to another table. Do I have to create a connection string and an oleDBconnection? Or can I somehow use the connection string that is in my app.config file? [Code]

View 9 Replies


ADVERTISEMENT

USING Statement And TableAdapters Connection

Nov 9, 2011

I need some help with correctly implementing the USING statement with strongly typed TableAdapters..[code]How can I use the USING keyword instead of Try.. Finally for the connection object?

View 2 Replies

Connection Strings To SQLExpress R2?

Aug 20, 2010

I have several programs I have written for my music studio/production company. Many dealing with inventory, customer DB etc. All of my programs are in VB6 and I have started to convert them all to VB.NET. I am getting proficient with VB.NET and connecting to DB using the very simple and generic connection strings, Example:

dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
dbSource = "Data Source = C:/develop/Customer Tracking/resource.mdb"
con.ConnectionString = dbProvider & dbSource

[Code]....

As you can see I am using a basic MSAccess DB and I want to get away from this and start using SQLExpress,

connect to a standard SQLExpress DB? (when I loaded SQLExpress I took the defaults...)

View 1 Replies

MS Office Connection Strings?

Oct 28, 2011

What is a dynamic MS Office Connection string? I have realized that each each version of MS Access has a unique Connection String. Now my concern is that if I use MS Access 2007, for example, it may haave compatibility/connection problems if an application is deployed in a machine with a different edition of MS Access. Is my understanding correct? If so, how to go around this hiccup?

View 2 Replies

Sql Server - SQL Connection Strings

Mar 19, 2012

I'm creating a program in VB.Net that heavily interacts with 2 large MSSQL databases. I do not know a ton of vb and I'm fairly new, but I would assume just having the connection strings in the code and releasing the program it would be quite easy for someone to reverse the program and get my connection info? correct me if I'm wrong. My question is I'm wondering if there is a safer way to use a connection string in my program. Would I just have to encrypt my app? Create a module or dll?

View 2 Replies

Build Secure Connection Strings?

Oct 3, 2010

I need a bit of advice. I would like to store secure connection strings somewhere safe in vb.net. How can I build the secure connection strings in what situation and what would be the best?

As I have done the little research and found that the secure connection strings would be encrypted the strings and input the strings in app.config, so I would have to make a change in the app.config[code]...

View 2 Replies

DB/Reporting :: Access Connection Strings?

Sep 12, 2011

I have been struggling with the construction of an Access connection string. Here's the problem.My Visual Basic 2008 project is located in a disk partition on my hard drive that I have named S:. My Access MDB file is in the same location.When I deploy the application it obviously will not be in an S: drive on the user's machine. My concern is that if I construct the Connection String using the file designations on my computer as:

(Provider =Microsoft.Jet.OLEDB.4.0; Data Source =S:MyApplicationmydatabase.mdb; User Id =admin; Password =

The deployed application won't know where to look for the data file. I know there are some shortcuts that will allow me to construct the connection string, but I do not know either the designated names or where to find them.

View 1 Replies

Passing Connection Strings Between Assemblies?

Sep 2, 2010

I have two executables that access a DLL containing Data Access Layer objects Each exe can have a different config containing info on server and database name, connection string etc.How do I pass the config info to the DAL objects?

Obviously I can pass the config strings to the DAL objects every time I instanciate one, but that seems messy and repetitive as every class in the DAL will require Properties for the Config strings..if there is a way for the instanciated DAL objects to read some properties from the calling object without me having to pass them explicitly?

View 2 Replies

Sql - Storing Connection Strings In Registry?

Nov 24, 2009

We decided to use the registry for handling our deployment with connection strings in our VB.net application.

The requirements are:

If the program cannot connect to the server, first check the registry for a connection string. IF not, create the folder and fill in the name, type, and data. Make sure its encrypted.

I have never edited or created anything in the registry.

View 2 Replies

Sql Server - Use Database Connection Strings In ASP.NET?

May 26, 2011

I've just started ASP.NET for real, and I was wondering if it is possible to use connection strings from Data Sources instead of hard-coding them. I've added my connection in Data Sources and it works, and I can also drag a table to a page in design mode, but I can't figure out how to access it in code. Here's what I get when I drag it in:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display.">[code].....

View 3 Replies

Store Connection Strings Per User?

May 21, 2010

In the past I've used a Singleton Pattern to load the connection string when the application starts via the global.asa file.

I have a project now where each user has a unique connection string to the database. I would like to load this connection string once. The issue is that the singleton pattern will not work for me since each user has there own connection string. Basically the connection string is created dynamically.

I do not want to store it is session. If anyway has a clever way of doing this in .NET let me know ?

View 1 Replies

.net - Retrieving Mysql Connection Strings From App.config?

Oct 24, 2011

How can I call the connection string by name from an app.config file in my vb.net program?

View 1 Replies

Accessing The Connection Strings From The APP.CONFIG File?

Dec 4, 2009

I'm having trouble accessing the connection string from the app.config file. my connection string is:
Dim sConnect As String = "Data Source=.SQLEXPRESS;AttachDbFilename=G:VB Level 1ProjectContactsDB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"

I using this string in a few different places, but I want to access it from the App.Config file. I've been at it for awhile and can't get it working.

View 3 Replies

Demonstrate How DbConnectionStringBuilder Works With Connection Strings?

Jul 1, 2010

from [url] they write this:

This example includes a password to demonstrate how DbConnectionStringBuilder works with connection strings. In your applications, we recommend that you use Windows Authentication. If you must use a password, do not include a hard-coded password in your application.but if we do not hard-code the password then does it mean that we are supposed to retrieve the password from some other place? so is it correct to say that we should save the password in a file and then retrieve it when the app runs?

View 10 Replies

IDE :: Missing Connection Strings In Application Settings

Nov 11, 2010

I am using VB 2008 & MS Access 2007 Databases for my Windows Forms Applications.The Problem is my Connection strings have been disappeared from DataSource Configuration Wizards & now i am unable to edit any Connection String in DataSet Designer.I had tried to create a Macro in MS Access Data File but didn't know how to create & so desided not to save any & just quit from Access and came back to Visual studio. Since then only this prob. has started. Earlier to this everything was just fine.I have tried to uninstall MS Office as well as Visual Studio then Re-installed Visual Studio but the problem is still there.

1] Error while trying to Reconfigure Data Adapter in Dataset

2] Disappeared options & Empty Connection Combo Box

3] Add Connection DialogBox with no DataSource property line in the Grid control

View 2 Replies

Read 2 Connection Strings From External File?

Sep 9, 2011

I have a situation where I have a vb.net program that uses two connection strings. This program will be used on multiple web servers on multiple domains and the only difference for any of them is the two connection strings.What would be the best solution to read in these connection strings from a file separate from my actual .vb code?

Ideally I want to be able to drop the .vb and the connection string file into its own folder on any number of asp.net websites and not update anything else (for example add any connections to the web.config or anything) than the external file containing the connection strings, I assume something like xml would suffice?

View 2 Replies

VS 2005 Build Secure Connection Strings

Oct 3, 2010

I would like to store secure connection strings somewhere safe in vb.net. How can I build the secure connection strings in what situation and what would be the best??

As I have done the little research and found that the secure connection strings would be encrypted the strings and input the strings in app.config, so I would have to make a change in the app.config

To change from this unprotected app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>

[Code]....

The code have been built to a guy who known as Nick J. Fessel. I am not too sure if it very secure to use it so. Do anyone know that if the connection strings is secure or not?

info for the secure connection strings without being found out

View 6 Replies

DB/Reporting :: Change The Connection Strings For The Local Computers?

Jun 9, 2009

I have finished my program and now i am ready to deploy it. The only problem is it is a multi-user application. All i want to do is simply run the program with the database from a server, and have other local computers with the program access this same database. I know that you have to change the connection strings for the local computers, but how can i go along doing this?

View 2 Replies

VS 2008 - Convert Existing DB Connection Strings From ADODB To ADO.NET?

Jul 14, 2009

I have upgraded my VB app from VB to VB.NET and its working fine. Now, I want to convert my existing DB connection strings from ADODB to ADO.NET so that I dont have to use MS Access on every client which runs this app. Currently the VB app looks up into an Access db to get the server ip, username, password etc. I aim to hardcode these values so that I wouldn't need the Access db anymore. Any inputs on how this could be done?

[Code]...

View 4 Replies

Click Once Signing Practices?

Apr 26, 2010

I have an app published using ClickOnce. When an app is published that way, you get a temporary certificate which expires in a year. My year will be up in a couple months, and I am considering my options.One option, which a colleague is using, is to build a more sustained certificate using makecert.exe. By doing this, I can get a certificate of arbitrary length (or so I am told, as I haven't actually followed this route, yet). The problem with this route is that MS is pretty clear that makecert is for testing purposes.

I can also see that I could go to verisign or some such and buy a certificate, but that has a significant cost (well, I'm sure my employer wouldn't be too concerned about it, but it seems pretty high to me). The program has very narrow applicabiliity and narrow appeal (it has to do with counting fish). What I am wondering is whether there is sound reason to go with a certificate that is more than what makecert will create, and what that reason is? Additionally, I'm looking for information as to whether an internal CA, such as we have, which can make a certificate, will cause me any trouble if I use it to sign a ClickOnce app that won't be used entirely internal?

View 7 Replies

Exception Handling Best Practices .Net?

Dec 8, 2009

I have a general question regarding best practices for exception handling. I have a class library that uses structured error handling. The functions in the library generally perform some mathematical calculations and all return a boolean value indicating whether an exception occured or not (i.e. exception occured = true, no exception = false). The actual calculated result in the function is returned as a ByRef parameter.

Anyway the input variables for my calculations are all passed to the funtions as parameters. I perform some basic checks on these inputs (e.g check that an input is not negative etc) as part of the function code. The next stage is where im unsure of the best way to do things. Using the example i just mentioned, if an input parameter is negative, I can either throw an exception such as "ArgumentOutofRange", or i can simply show a messagebox with some info about what happened. Either way i do it the function will return true. At the moment i am throwing an exception, but on reading the "Best practices for exception handling" it is recommended you dont throw an exception for things that can be checked programatically because of "performance/overhead issues".

I'm a little confused by what they mean by this. What kind of overhead are they talking about? Slower program? More disk space required? More memory required? When my functions return true, the calling methods basically drop everything and stop calculations (exit sub), so im not sure that the overhead issues they are talking about are as important to me. It seems easier and neater to throw an exception and utilize some global error strings and pass some parameters rather than copy and paste messagebox.show() all the time, and modify the text to suit the situation. Another argument for me would be that both methods of exception handling utilize a messagebox, which stops code execution until the user does something. So i cant see the issue with the performance overhead.

View 5 Replies

Know What Bad Practices Are Present In Code?

Aug 29, 2011

I'm an avid programmer, and I'm trying to teach myself more professional practices, but Ilook over my code, and point out any mistakes, or bad practices I may have attached to this actually working bit of code. It consists of a procedure for retrieving, sending, and above all connecting to a server program. As for the various amounts of sloppy commented out code, after a long time clearing my head, I came to my senses so to speak.


Imports System.Net.Sockets
Imports System.Text
Imports System.Threading.Thread

View 4 Replies

Dynamic Connection Strings - Developed Apps For Desktops With An Access Database On One Server

Jun 1, 2012

[i][b]I have always developed apps for desktops with an access database on one server for one company or sql server. I had one connection string. Now I am in a situation with multiple clients using my software on their own server. This means different connection strings can anyone suggest an efficient way to do this without changing connection strings for each server throughout the application?[/b][/i]

View 1 Replies

Way To Concatenate List Of Strings Into A Comma-separated Strings, Where Strings Are Members Of An Object?

Oct 16, 2009

Say I have a List(Of Tag) with Tag being an object. One member of Tag, Tag.Description, is a string, and I want to make a comma-separated concatenation of the Description members.Is there an easier way to do this than to read the Description members into a List(Of String) and then use the Join function?

View 2 Replies

Sql - Correct Error-handling Practices For The Data-layer?

May 28, 2009

What are good things to check for, with respect to error-handling, when you are dealing with the data-access-layer? For example, let's assume I have this function..

Public Function UserExists(ByVal userName As String) As DataTable
Dim dt As Object = Nothing
Dim arSqlParameters(0) As SqlParameter

[code]....

How would you go about ensuring that your code elegantly handles anything unexpected in a situation like this?

View 5 Replies

Consolidating And Filtering IList Items, Looking For Paterns, Practices, Or Existing Methods?

Sep 11, 2010

I'm reading a binary file into a bindinglist of (t); to be bound to a datagridview.Each line in the file represents a single transaction but I need to consolidate and or filter transactions that meet certain criteriaI know how to do this from a mechanical standpoint (looping the list while adding each item, and adding a new item, or merging the data with an existing item), but I'm looking for a practice, pattern, existing components, or something else that I'm missing (I'm drawing a blank for keywords to search).I don't want to reinvent the wheel if I don't have too. I'm particularly concerned with speed and performance issues with 100k plus records to process in some instances.Currently working with .NET 2.0, but will move to 3.5 if a particularly sexy solution exists.

View 2 Replies

Using Update With TableAdapters?

Sep 2, 2011

When a person makes changes on my datagridview and closes it, I want it to automatically go into the database and update in a new column (which is already been created) the text "changed".

Everything in my tableadapters already works. Its just the VB part which I dont know how to call the update command. Here is what I have in my updatedataset().

Private Sub UpdateDataSet()
Dim datasetChanges As datasetTs = New datasetTs
Me.bindingsourcet1.EndEdit()

[Code].....

View 2 Replies

Retrieve A List Of Tableadapters?

Dec 14, 2009

Most of my programs use table adapters, and the connection strings are stored in app settings. This works fine, but was a real PITA when switching from development to production environment. I had to change manually the connection strings before and after starting my work on any app.

After a bit of research I found how to switch connection strings for table adapters dynamically. By simply adding a custom property for connectionString, I was able to acheive this. But I still have to add code in the new event for each application so the connection strings get switched when it loads. (My connection strings are kept as an app property setting in a common DLL. I just keep one copy of the DLL with my connection strings locally, and one copy o the DLL with the production connection strings on the production server.)

I'd like to take this one step further and have either have the datasets change the connection strings for all table adapters they each contain when they load using the new event, or do the same from a VB module. I may have up to 3 datasets at any one time.

View 1 Replies

Tableadapters Are Not Appearing In Toolbox

Dec 17, 2011

I added few new tables on data sheet (file name nwinddata.xsd) but the new added table adapters does not appear in toolbox whereas the old adapters were appearing. I read somewhere and followed their advice to delete the project and re add the project to the solution explorer, did that, now i can't even see old adapters in tool box all gone.When i restored my backup old adapters appear in toolblx but few days of will be lost which i don't want.

View 2 Replies

VS 2008 TableAdapters Connections?

Jul 8, 2009

I need to change the connection string of all tableadapters at runtime, can anyone tell me for the best way to do it?I have a conection string in my settings, that i can't change at runtime (application scope), i could go to dataset.designer and change the value to a new variable but i don't think this is a good method.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved