As you can see, the connectionstring parameter is defined to a specific connection string name and I need to be able to set such a parameter to a different value, for example, to a session variable content.
I am storing a custom "Organisation" object as a session variable. One of the properties of the Organisation object is "OrganisationID" (integer). I have a DataSource that requires a parameter value to run, and I want to use a SessionParameter to populate this. In a previous version, I stored the OrganisationID directly as a session variable. In that case, I could easily access it like this:
However, how do I now access the OrganisationID property of an "Organisation" type session variable (called "Organisation")? I have tried this, which does not seem to work: <asp:SessionParameter Name="OrganisationID" SessionField="Organisation.OrganisationID" Type="Int32" />
I've done some SSIS package work in the past, but am by no means an expert.
I want to use an SSIS package to do the following:
1. Get the file name of the newest file in a windows folder (using a filename template like his: filename_ *.txt where the * part is always a date in the format of yyyy-mm-dd.
2. Use that file name in later portions of the SSIS package by reading the file and transferring data from it to a SQL table using a Data Flow task.
and use the result (which should be the name of the newest file) to open that file and pull data out of it and into a 2nd SQL table. I admit, I'm not sure how to use the dynamic result of this SELECT query as the file name in a flat file connection manager.
I am thinking of putting a drop down list to choose a couple of options. Depending on what is selected I want to then specify a specific connection string. I use the ConnectionString="<%$ ConnectionStrings:SomeConnectionString %>" format. How can I handle this in the .aspx page?
I am using CLR project in my website.I have used bulk insert in there.I am not able to use context connection in the procedure.Is there any way to get the connection string from web.configor from context connection.
i work with sql database i want to connect to sql server i dont have sql manegment who could i c the connection string the palce of the sql that wen i write these comand sqlconnection con = new sqlconnection("the connection string")
I have an app that connects to only one db for all of the data that the app has access to. My connection string is in the Web.Config file. In each of my DAL classes I have the following code that gets the connection string from the Config file. This works with no issues but I thought there might be a better way of doing this that I don't know.
If I wanted to change the name of the connection string that any of the DAL classes would use then I would have to change the name of the connection string in each of the files. I thought about creating a new class that would hold this then I could just instantiate a new instance of the class to access this with each of the DAL classes that needs access to it. Then if I needed to change the name of the connection string then it would only be in one place. I suspect there is an even better way of doing this that i don't know about.
My question is: I have update stored procedure in my database (simple update stmt) I am finding difficulty in writing a ADO.Net(C#) connection string for update stored procedure. i have 4 columns and i first 3 columns have constant values. The 4th column values needs to be updated. At the same time i need to increment and then update the table.
I am using LINQ to SQL files in my class libray since every LINQ to SQL sources file is a seprate file and i have to set database connection string in each class library. Now, i have total 7 class libraires in my project how connection string be passed from web.onfg to LINQ file, so that i don't need to manually change the connection string. lke we did in asp.net 2.0 using connection string property in class file library.
How could we pass the same in LINQ's designer file.
and later using it as a parameter to the stored procedure.
The logic here is, the user should login first in order to retrieve his/her album. when the user is logged in, im retrieving the 'userid' and using it as parameter to load the corresponding album from the database.
when i login and open the albumpage, im end up with this exception:
"Failed to convert parameter value from a String to a Guid".
What could be the reason and how can i avoid this exception.
by the way im using the aspnet_Users table's userid field.
Is it possible to save execute stored proc command in a string variable and then execute string variable? Does this logic fits into LINQ2SQL? Why I want to do this - INstead of passing user control references to server, I want to save user control values to string in client side java script and then pass string to server to do actual stored proc execution. Hopefully this will improve performance.
I'm trying to compare a parameter of type String with a database field of type ntext. Below is my vb code. carDescription is a field in the database table that is of type ntext. The code didn't work because you can't use the equality operator.
Dim carDescriptionLookupCmdString As String = "SELECT carMake FROM car WHERE carDescription = @description" Dim carDescriptionLookupCmd As New SqlCommand(carDescriptionLookupCmdString, dbConnection) carDescriptionLookupCmd.Parameters.AddWithValue("@description", description) Dim reader As SqlDataReader = carDescriptionLookupCmd.ExecuteReader()
Background: I use SQL server 2005 developer edition and visual studio 2008. Visual studio 2008 is running on a local machine with Vista business edition. SQL server is running on a remote server using Windows server 2003. Both computers are within the same domain.
Problem: First, I used the server explorer to connect to the SQL server. Everything works as desired. Then I write code to do the same thing. I keep getting the following error message:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)
However, I used the exactly identical connection string as the one used in the server explorer. So connection string should not be the problem. In addition, I tried the test code in MSDN, which tells whether my domainusername can flow the network. It turns out the user name is fine. I also went to the SQL server management studio and found the login for my computer is NVCWeihao while my computer login name is NVCweihao. I am wondering if this uppercase letter really affects the connection.
i am trying to create connection using OLEDB connection in my app. but i am not able to create the connection as in datasource i want to use Server.mappath, but cudn't find the right method to use it. i am trying to make connection with Access database file. following is code i have tried:
string path = Server.MapPath("~/uploadaccess/Production.mdb"); string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb")&";"; and also OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path&";"); and tried this OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb"));
and this is the error i am getting:
Operator '&' cannot be applied to operands of type 'string' and 'string'