I was wondering what is the ideal way to reference a connection string.I'm using Visual Studio 2008.I am new to VB.NET and I inherited this piece of software from another developer.
He currently uses a class (shown below) that is not part of the entire Solution, but is saved as a .dll file called clsDBConn and is located in the Reference folder in the Solution Explorer. This seems like a long way to access a connection string,
Is this the ideal way to access a connection string?[cod]e...
How do I assign a My.Settings.Item connection string to cmd.Connection connection string value?
Dim cmd As New SqlCommand() cmd.Connection = My.Settings.Item("csStaffHoursWorked") cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "spSaveDeltekImport"
I got this Error Message while I try to preview the records in Dataset Designer:"The connection string could not be found or Data provider associated with the connection string could not be loaded"
I understand the possibilities for encrypting a connection string in .net v4. I have a win forms application that will be used by multiple people on different machines. I understand that I need to protect the connection string at time of the app being first run on the target machine. However I am concerned that for a period of time my connection string will be unencrypted. I am looking for advice in how to deploy my app with the connection string already encrypted or encrypted during installation. encrypting the connection string in a secure way?
I'm developing an app in vb.net (visual studio 2008). I have a Teradata back-end that will be supporting multiple users in a production environment. I need to use variables in the connection string as the user/pass will be changed every 3 months.
For the gist of the application:
In it's most basic form - I have a search form which works correctly - it pulls results into a listbox and the user then double clicks the list box which will then open a form that is bound via table adapter to the back-end table (Teradata). My connection string is fine everywhere in the application. My problem is using a modified connection string for the "fill" function of the table adapter once the form is opened.
I'm using the code below for the on-load event and keep getting an "invalid connection string" - again, the connection string works fine everywhere else in the app, and the variables etc... are working correctly.
Private Sub adaptertest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim DBConnStr As String = "Provider=TDOLEDB;Data Source=TDDEV;Persist Security
I'm facing a problem after installation any software setup that has a database in access(mdb file) How to I transfer file path in our connection string.
I am trying to connect DSN from my VB 2008 project. When i try using myoledb.connectionstring="DSN=myDNSname" I get the following error message An OLEDB provider was not specified in the connectionstring.
I know I'm being an idiot here and I just can't work it out. But i'm trying to take some data back from a vb.net database. It's falling over with a Object reference not set to an instance of an object error. And before the code runs it's saying the variable is being used before it's set, but I can't see how. Code:
Private taNotifications As dsDataTableAdapters.NotificationsTableAdapter = New dsDataTableAdapters.NotificationsTableAdapter Dim notification As dsData.NotificationsDataTable = taNotifications.GetDataByClientID(userrow.UserID) If notification.Rows.Count > 0 Then Dim notificationrow As dsData.NotificationsRow Dim forwardURL As String = notificationrow.ForwardLocation End If
It falls over on the Dim forwardURL As String = notificationrow.ForwardLocation
I'm trying to connect to an 2007 access database. It looks like my connection string is right but I get an error stating "Object reference not set to an instance of an object."
My database is in the correct folder. in this case I'm debugging so I have it in my debug bin. I've even checked my application start up path to confirm that I have it in the correct folder. I also double checked my extention. For Microsoft office 2007 the extention is accdb. I've also checked the file name spelling and case etc and all matches.
I have conn set as Private conn As OleDbConnection
Why doesn't an exception get thrown when this function is called when there is no ConnectionString set for the Connection? I just spent 15 minutes debugging and staring at it and finally figured out it needed the connection string. Shouldn't an exception get thrown?
Friend Function GetValues(ByVal TableName As String, ByVal FieldName As String) As DataTable Dim cn As New SqlConnection Dim cmd As New SqlCommand[code].....
So strings are reference types right? My understanding is a reference to the string in the heap is passed even when you pass the string ByVal to a method.
I have multiple TcpClient connections to my program. The connections exist as instances of a UserConnection class, that fires events on logon attempt and when receiving messages. My program also holds a Users object, which is a list of a User class objects, holding saved data (username, password etc) for each user that is allowed to log in.
It seems convenient to put a reference object of the respective user, in the UserConnection class (when successful login is verified). Hence, when an event is raised by the connection, the connection object will hold the user reference. As any event handler logic will need to know which user is responsible for the event.
If I don't make a user reference in the UserConnection class, then I need to loop through the users (less than 20) each time, to find the correct user. Not a big deal maybe, but i'm looking to understand how it would be done by an experienced programmer.
When data needs to be sent to a user, I need to access a UserConnection object. Hence the User class also holds a reference to the UserConnection class.
To simplify my problem, lets say I have 200 textboxes on a form. I want the first 100 to become disabled in a certain subroutine. I don't want to write 100 lines to disable each textbox; I'd rather write a loop to do it but can't figure out how. For instance:
dim i as integer dim s as string for i = 1 to 100
[Code].....
I tried "dim c as new control" then "c.name=s" but I don't think this makes "c" as a member of my form and it didn't do anything as a result. I think I need to figure out how to declare c as a control that exists within my form but can't figure out the syntax for that.
I am trying to do a conversion of a sting to an array name. I have a few arrays called "f2250", "f2255", "f2260" and so on. When a user enters say 2.50 into a textbox, the program needs to be able to reference the f2250 array. Now ive managed to sucessfully code the creation of the string ie "f2250(1)" (Ive added the (1) as a test to refrence an index). How can I use that string to now return the value that is in the array? Does the string need to be converted into something else?
I understand that an array variable contains a reference to an array object - it is a reference type. string variable is also a reference type. So, if I make a copy of either one, a change to the copy should also change the result I get when I look at the original because both refer to the same object. In the following code, I expected to see "Whoooy" as the result for original and copy for both the array and the string. It works with the array but not the string.
I am trying to make an app that interfaces with Salesforce. Now within salesforce you can customize your database to have any tables or fields that you want/need What I am trying to do is once I do my query, salesforce has your query results returned as a salesforce object. My app basically manages info in salesforce based on rules, sometimes people may need to customize those rules based on fields in the database, however because I dont know what kinds of fields are in their particular database I need to do it programatically...
SO what I want to do is reference the objects property via a string text property name... i.e. if they use a field called "IsFromLebanon" as a boolean I want to be able to access QueryResult.IsFromLebanon. but since I dont know if that field exists or not I dont know how to access its property without spelling out each time. I know clearly thats not going to work, but I dont know how to access the property name without KNOWING the property is going to be there, does that make sense? I dont know if I am making sense or not, it makes perfect sense in my head
I am using VB.NET and ADO 4.0. Given that I have a string containing a reference to a table.column, can I use the content of the string in a command? [code] I got to the point where I can use the string contents as "reference", it seemed to obvious but [strName] does the trick, partially.When I debug bookableday.room1 remains 0 whilst it should show 6. There might be a conversion issue because the debugger shows me "6" i.s.o. 6 . this is the actual code: [code]
After using the following code, no errors are shown, but my database is not updated once i have made a change using my management system application.
Dim constring As String = Application.StartupPath.ToString() + "mydatabaseName.mdf" Public c As String = "Data Source=.SQLEXPRESS;AttachDbFilename=" + constring + ";Integrated Security=True;User Instance=True" Sub openConnection() conn.ConnectionString = c conn.Open() End Sub
I using SQL Server 2008 R2 to connect with HTML page. I trying to connect HTML page with login to SQL Database. I have try called the Source but didnt work.
I am developing a software which will connect to a SQL SERVER situated at Head Quarters over a VPN connection.But for times when VPN is disconnected I want my applications at the branches to connect to a local Sql Server installed at a local server.Now all the applications at each of the local machines have their connectionstring stored in their App.config file.When the VPN is disconnected we have to change each of the connection strings on all the applications in each machine. Is there a way to do it automatically switch the connection string depending on whether the Server is reachable or not, and to store the connectionstring at centralised location.
I'm trying to change my connection string to w/e the user wants. After a few tips here and there, this is what I've come up:
1: In my settings I've added - Name(login), Type(String), Scope(User), Value(Nothing)
2: Here is the code I'm using
Private Sub LoginForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Here I'm checking if the login in my.settings is there 'If not, I'm going to let the user choose what database
[code]....
The error I get is: Format of the initialization string does not conform to specification starting at index 0.here -
Dim con As New OleDbConnection(My.Settings.login)
When I have my con equal to when I added the datasource from it works.
i have the connection string cn = New OleDbConnection("Provider=Microsoft.Ace.OLEDB.12.0; Persist Security Info = False;" & _ "Data Source=C:printtest2.accdb;")which works fine but my database is in the server in a network what additional details do i need for the connection string The server name is as follows "Prntsvr-Test.auhbr.ctrixa.ad"how do i use the connection string
I have installed sql server 2005 in my machine which is installed vb.net 2008. I want my machine to distribute the database to the clients and make it as server.I don't have that much knowledge of how to overcome this issue as i am awfully naive about it.Let me start it here:I have got an application in vb.net...at first i was using ms access database 2007. then decided to switch on to the sql server since i want to distribute the database to the clients who are going to use my application.When i installed the sql server, i imported my access db files onto sql server database. i enabled tcp/ip as enable in the sql server network Configuration. i want use sql server windows authentication as my default user account of my system for the sake to simplify the issue.
Hence, i connected the sql server into the vb.net through the "add new data source".am done with that...the problem is how do i assign the connection string to the vb.net? Or how do i include a connection string in vb.net which tells every other computer that the database data source is in my computer so that every computer can automatically check it in the network.Where exactly shall i put the connection string...as far as my knowledge is concerned for access database, you can easily identify your connection string in project /properties/settings...it goes here and you put your database in any where.And what is the best connection string do i need for sql server 2005..computers are running windows xp.
I used to work only with asp.net websites before. I know that in ASP.NET website, the connection string is found in the web.config file. My problem is now I have started working with VB.NET applications which needed to be interfaced to a database. How is a connection string created and where should I put it?