Thursday, March 29, 2012
consolidate two data files
ThanksFollow this:
http://groups.google.com.au/group/microsoft.public.sqlserver.server/browse_thread/thread/d7fa8af9c5ca5ca/71636c29fdf2666c%2371636c29fdf2666csqlsql
Sunday, March 25, 2012
connectivity sql ce
hi friends,
i am developing a dictionary for pocket device
i am using sql ce database .
i have included and copied that file in the project but every time exception occurs saying check the directory . file can not be found.....
may be this a little one but help me......
its urgent..........
What code are you using to open the database?|||Public Function search(ByVal s As String)
Dim conn As SqlCeConnection = Nothing
Try
conn = New SqlCeConnection("Database='Dictionary.sdf';password='<pwd>';")
conn.Open() '<here it stops saying that file not found
Catch
Finally
conn.Close()
End Try
conn.Close()
Return 0
End Function
|||On device, there is no relative path concept. So, please use full/absolute path!
Thanks,
Laxmi
|||ok that part is done
using path as data source='program files/projectfolder/database'
now i have to connect a application on pda to a sql ce database on desktop
is it feasible if yes please
provide me the syntax
connectivity sql ce
hi friends,
i am developing a dictionary for pocket device
i am using sql ce database .
i have included and copied that file in the project but every time exception occurs saying check the directory . file can not be found.....
may be this a little one but help me......
its urgent..........
What code are you using to open the database?|||Public Function search(ByVal s As String)
Dim conn As SqlCeConnection = Nothing
Try
conn = New SqlCeConnection("Database='Dictionary.sdf';password='<pwd>';")
conn.Open() '<here it stops saying that file not found
Catch
Finally
conn.Close()
End Try
conn.Close()
Return 0
End Function
|||On device, there is no relative path concept. So, please use full/absolute path!
Thanks,
Laxmi
|||ok that part is done
using path as data source='program files/projectfolder/database'
now i have to connect a application on pda to a sql ce database on desktop
is it feasible if yes please
provide me the syntax
Thursday, March 22, 2012
ConnectionString using SQL Server
Hello all,
I tried several connectionstrings in web.config file shown below and got this error "Application Error" (ErrorPage.htm).
<add name="ClubSiteDB" connectionString="Data Source=myClubs;Initial Catalog=Clubs;User Id=xxxx;Password=xxxx;" providerName="System.Data.SqlClient"/>
<add name="ClubSiteDB" connectionString="Driver={SQL Server};Server=localhost;Database=clubs;Uid=xxxx;Pwd=xxxx;" providerName="System.Data.SqlClient"/>
I created SQL Server 2000 database called clubs and ODBC DSN called myClubs at web hosting. It worked at local machine with no problem, but transfer from local machine to web hosting is something I'm not familiar with. Please advice. Thanks.
EagleGolf
check out www.connectionstrings.com|||
Hi!,
U have to specify the server name rather than 'localhost', if u r using trusted connection then it should be:
Database=Test;Server=Machine1;Trusted_Connection=Yes,
If not then specify the Userid and password:
server=Machine1;database=test;uid=xxx;pwd=xxx
Hope this will help
Regards
The server name would be the url connected to the database. Or just the name like .\SQLEXPRESS? I use your method and it didn't work like it should.
|||Hi,
Are u using SQL Express? If yes, then check this URL:
http://www.eggheadcafe.com/articles/20060719.asp
Hope this will help.
Regards
|||I finally figured it out. I had the server name wrong and now it is corrected. Thanks for all of your help. Have a nice day.
Tuesday, March 20, 2012
connectionstring gets populated unwillingly
Hi,
I hav eplaced an expression for the flat file connection as below
@.[User::FileDirectory] + @.[User::FileName]
This is supposed to be used instead of the ConnectionString property of the flat file connection.
You can see that I have created two variables.
The variable
@.[User::FileDirectory] is set to the directory. i.e. I have hardcoded the path to it and assigned it to this variable.
The variable @.[User::FileName] is picked up automatically.
The question is:
When I go to the properties of the flat file connection, I delete the value inside the connectionstring property becuase there is now the expression which is set to the connectionstring.
But when I come back to this property then I am not sure why the connectionstring property gets populated with the directory that I hardcoded to the variable.
Many thanks
arkiboys wrote:
Hi,
I hav eplaced an expression for the flat file connection as below@.[User::FileDirectory] + @.[User::FileName]
This is supposed to be used instead of the ConnectionString property of the flat file connection.
You can see that I have created two variables.
The variable
@.[User::FileDirectory] is set to the directory. i.e. I have hardcoded the path to it and assigned it to this variable.The variable @.[User::FileName] is picked up automatically.
The question is:
When I go to the properties of the flat file connection, I delete the value inside the connectionstring property becuase there is now the expression which is set to the connectionstring.
But when I come back to this property then I am not sure why the connectionstring property gets populated with the directory that I hardcoded to the variable.Many thanks
This is by design. The connectionstring property is picking up the value from the expression. Don't worry about it. It will be correct at runtime.|||
I'm not sure if this is correct because in the connectionstring property it shows:
\\gblond088s0b\D$\ApplData\CEM\WorkingTemp\
and in the expressions it shows:
@.[User::FileDirectory] + @.[User::FileName]Please note that in the variable design I have manually assigned the variable @.[User::FileDirectory] to the path above
Thanks
|||I forgot to mention that it gives the following error:
Error: 2007-07-26 18:10:05.39
Code: 0xC020200E
Source: Data Flow Task Flat File Source [1]
Description: Cannot open the datafile "\\gblond088s0b\D$\ApplData\CEM\WorkingTemp\".
End Error
so basically, it is not seeing the filename. it only sees the directoryname
Thanks
|||
arkiboys wrote:
I forgot to mention that it gives the following error:
Error: 2007-07-26 18:10:05.39
Code: 0xC020200E
Source: Data Flow Task Flat File Source [1]
Description: Cannot open the datafile "\\gblond088s0b\D$\ApplData\CEM\WorkingTemp\".
End Errorso basically, it is not seeing the filename. it only sees the directoryname
Thanks
Right. You need to give the Filename variable a default value. And if, during runtime, it still cannot find the data file, then you aren't populating the Filename variable correctly.|||
This is strange.
If I use a loop and give it the full directory path as described before, the foreach loop picks up the filenames and runs the package successfully. But I do not want to use a loop.
The package gets called once per filename. So the filename gets passed to the package and I want it to run but obviously it does not.
Not sure why the filename does not get populated when it is being passed to the package.
Thanks
|||How are you populating the Filename variable otherwise?|||I have created a variable called @.FileName.
There is also a flat file connection which has a path to the directory as described before.
There is a command prompt which someone else is in charge of running, at the end of this command it passes the filename.
How do you think the filename should get populated?
note that I do not have this problem when I use a foreach loop but for this project loop is not required.
Thanks
|||
arkiboys wrote:
I have created a variable called @.FileName.
There is also a flat file connection which has a path to the directory as described before.
There is a command prompt which someone else is in charge of running, at the end of this command it passes the filename.
How do you think the filename should get populated?
note that I do not have this problem when I use a foreach loop but for this project loop is not required.
Thanks
I'm asking HOW you are passing a value to the Filename variable. HOW is the command line, that someone else is in charge of executing, populating the Filename variable? You need to know this before asking your questions here.|||
Ok,
If I want to run the package myself, how can I do this using the command line?
Thursday, March 8, 2012
connection to SQL from asp.net page
"Data Source=MIAPPS1;Initial Catalog=MASTER_DB;Integrated Security=SSPI;"
However, when I add data to the page and try to preview it in the browser I get the following error:
"System.Data.SqlClient.SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."
I'm kind of perplexed as to why I can attach a database to my page, test the connection view data -but not be able to connect when previewing through the browser.
Any Ideas?
BillHave you added the ASP.NET account to the server server authorized logins?|||I have added an account ASPNET. Is it ASPNET or ASP.NET. The error message also showed, null for the login, does this still point to the ASPNET login issue?|||Yes. The errors means that you either trying to connected to SQL with SQL Authication while only Windows Authentication is enabled, or that the windows account you're using is not one enlisted into the sql logins account.
If you're using IIS5 the account is ASP.NET, if using IIS6 is the Network Service account
Friday, February 24, 2012
connection string problem...
Basically, I have a webconfig file with the connection string to a sql server database.
I have 2 pages...both reference the connection string in the web config file...
the first page is a logon page - this accesses the database and executes properly, however, the second page raises an exception when opening the connection with the following
"The connectionString property has not been initialized".
As an additional note, I have pulled source code from 2 different machines and done a rebuild on the project - not sure why this would have a bearing on it but maybe I am missing something.
Anyone shed any light on it?
Thanks in advance!Can you post your web.config string and the one used in code
There may be a possibility that name in web.config and the one used in code are not in same case...or there is typo...|||The definition in the program is:
Dim cnRobDb As New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
and within the web config file:
<appSettings>
<add key="connectionString" value="data source=RobSQL;initial catalog=Robdb;user id=sa;pwd=??" />
</appSettings>|||Does it give error when you use
|||Tried coding as suggested and no it doesn't work - still get the same error. Like I say the wierd thing is that it the other program that runs first, the connection is made and data accessed correctly...mmm very strange.|||Can you post your code
Dim cnRobDb As New SqlConnection("data source=RobSQL;initial catalog=Robdb;user id=sa;pwd=??" )
Where are you writing the code for SqlConnection??|||Sushila,
thanks for taking the time to read and respond to this query, your help and time is very much appreciated!
I have solved the problem and interesting it was too. Basically, I had 2 versions of the .netframework installled: 1.0.3705 and 1.1 (installed simultaneosly).
This has not proved a problem until I imported code from another developer. It was importing the code that seems to have brought the problem out into the open. I removed version 1.1 and the problem has now disappeared! The database connection string in all code was identical and was stored in the web.config file but as shown in previous posts was manifesting a "connection not initialized" in certain programs but not others.
Thanks :)
Rob.
Connection string from outside
Hi there!!
I want to make a package and pass connection string from outside say through .ini file, so that I can put package on any system and use some external source to pass connection string.
How do we do this in SSIS?
Rahul Kumar, Software Engineer, India
Hi,
Package Configurations in SSIS are used for the same purpose that you are looking for. Package config can be used to pass on the values to the package at run time. For more details, please check http://msdn2.microsoft.com/en-us/library/ms141682.aspx
Let me know if this solves your issue.
Thanks,
S Suresh
|||Hi Suresh
Yeah this is fine,we can assign configuration settings but still I am scratching my head how to change connection string in connection manager
|||If you define a configuration, this is held as part of the package definition. In yoru case you would define the configuration such that the property value to be set is the ConnectionString of the specified connection.
When the package loads the config is processed, so your new connection string is read for the specified location and applied. That loaded instance of the package will have the new connection string on the connection manager.
Still got an itch? If so can you explain why you do not think thsi solves the issue?
|||When you go through the Package Configurations Wizard choose the ConnectionString property of the ConnectionManager you want to configure. At runtime it will try and configure that property for you. You don't have to manually set it.Sunday, February 19, 2012
Connection String for SQL 2005 Express
My C# app uses SQL Server 2005 Express edition.
I store my connection string in a config file.
My application will run on numerous machines and therefore the machine name
will be different each time. What I would like is a generic connection strin
g
so that I don't have to change it each time I install my app on a different
machine.
I therefore want to avoid specifing the machine name in the connection
string as shown below :-
"Data Source=MachineName;Initial Catalog=pubs;Integrated Security=SSPI;"
Is there any way to make this connection string generic so that it can stay
the same between different machines?
Thanks
MaccaIf you run your application on the same machine as the database, . (period)
works as a server name. So if your install SQL Express with the default
instance name, the server name is .\SQLEXPRESS
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Macca" <Macca@.discussions.microsoft.com> wrote in message
news:B0A6D9FF-6715-4BBD-83BB-0C8B1F9A7098@.microsoft.com...
> Hi,
> My C# app uses SQL Server 2005 Express edition.
> I store my connection string in a config file.
> My application will run on numerous machines and therefore the machine
> name
> will be different each time. What I would like is a generic connection
> string
> so that I don't have to change it each time I install my app on a
> different
> machine.
> I therefore want to avoid specifing the machine name in the connection
> string as shown below :-
> "Data Source=MachineName;Initial Catalog=pubs;Integrated Security=SSPI;"
> Is there any way to make this connection string generic so that it can
> stay
> the same between different machines?
> Thanks
> Macca
Connection string for express
Hi,
I'm trying to set up a connection string to a simple SQL Express database file
but I keep getting an error.
I copied this string from the Database object in the Database explorer. I changed the slashes to forward slashes to get rid of the escape sequence issue & changed the timeout & Integrated seccurity but apart from that it's the same.
The file is in the same directort as the Solution so I guess you can say it's Local.
Any ideas on a correct conenction string would be most appreciated
Thanks very much in advance
Ant
Code Snippet
string conString = "Data Source=./SQLEXPRESS;"
+ "AttachDbFilename="
+ "'C:/Documents and Settings/aklune/My Documents/Visual Studio 2005/Projects/WindowsApplication1/WindowsApplication1/test.mdf';"
+"Integrated Security=True;"
+ "Connect Timeout=10;"
+"User Instance=True;";
SqlConnection con = new SqlConnection(conString);
con.Open();
con.Close();
Hi,have a look on this site for connectionstring related issues.
http://www.connectionstrings.com/?carrier=sqlserver2005
Zafar Iqbal|||Did you try to use theSQLConnectionStringBuilder ?
Code Snippet
SqlConnectionStringBuilder sb = new SqlConnectionStringBuilder();
sb.DataSource = ".\\SQLEXRESS";
sb.UserInstance = true;
sb.AttachDBFilename = @."C:\Documents and Settings\aklune\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\test.mdf"
sb.IntegratedSecurity = true;
sb.ConnectTimeout = 10;
string COnnecitonString = sb.ToString();
You don′t need to escape the characters if you use the @. sign before the quote for your string.
Jens K. Suessmeyer.
http://www.sqlserver2005.de
|||Hello Jens,
Thank you very much for your help there. I didn't know about the ConnectionStringBuilder or the @. sign. Both great tips.
The issue still persists though.
The error is:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
The database file is located on the local machine as suggested by the Filename path so I'm not sure that it's a "Remote connection". I'm not sure if this is just a generic error.
I have checked that the file exists for that location & I used the code you supplied as a test but I still get the above error.
Is there anything else I might need to check?
Many thanks again
Ant
|||You need to verify that you indeed have a running SQL Server.|||Hi Arnie,
Thanks for your answer.
I am running SQLSERVER 2005 Express edition. How can I tell if it is 'running'?
If I open SQL2K5 Xpress, I can run queries against the db's & things look fine, but even if it is open, I still cannot connect VS2005.
Does SQL2005 actually need to be 'Open' to be running? I shouldn't think think so.
When I try another approach of adding a New Data Source from within VS2005 data sources tab, when I navigate to the MDF file & choose it then test the conenction , I get the error:
"Generating User instances in SQL2005 is disabled".
However I still get the error after running sp_Configure 'User instances enabled' SP.
Thanks for your ongoing help on this one. I just can't seem to get a conenction happening.
Maybe it's not possible to conenct to SQL2005 Express?
Thanks very much for your help here
@.nt
Connection string for express
Hi,
I'm trying to set up a connection string to a simple SQL Express database file
but I keep getting an error.
I copied this string from the Database object in the Database explorer. I changed the slashes to forward slashes to get rid of the escape sequence issue & changed the timeout & Integrated seccurity but apart from that it's the same.
The file is in the same directort as the Solution so I guess you can say it's Local.
Any ideas on a correct conenction string would be most appreciated
Thanks very much in advance
Ant
Code Snippet
string conString = "Data Source=./SQLEXPRESS;"
+ "AttachDbFilename="
+ "'C:/Documents and Settings/aklune/My Documents/Visual Studio 2005/Projects/WindowsApplication1/WindowsApplication1/test.mdf';"
+"Integrated Security=True;"
+ "Connect Timeout=10;"
+"User Instance=True;";
SqlConnection con = new SqlConnection(conString);
con.Open();
con.Close();
Hi,have a look on this site for connectionstring related issues.
http://www.connectionstrings.com/?carrier=sqlserver2005
Zafar Iqbal|||Did you try to use theSQLConnectionStringBuilder ?
Code Snippet
SqlConnectionStringBuilder sb = new SqlConnectionStringBuilder();
sb.DataSource = ".\\SQLEXRESS";
sb.UserInstance = true;
sb.AttachDBFilename = @."C:\Documents and Settings\aklune\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\test.mdf"
sb.IntegratedSecurity = true;
sb.ConnectTimeout = 10;
string COnnecitonString = sb.ToString();
You don′t need to escape the characters if you use the @. sign before the quote for your string.
Jens K. Suessmeyer.
http://www.sqlserver2005.de
|||Hello Jens,
Thank you very much for your help there. I didn't know about the ConnectionStringBuilder or the @. sign. Both great tips.
The issue still persists though.
The error is:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
The database file is located on the local machine as suggested by the Filename path so I'm not sure that it's a "Remote connection". I'm not sure if this is just a generic error.
I have checked that the file exists for that location & I used the code you supplied as a test but I still get the above error.
Is there anything else I might need to check?
Many thanks again
Ant
|||You need to verify that you indeed have a running SQL Server.|||Hi Arnie,
Thanks for your answer.
I am running SQLSERVER 2005 Express edition. How can I tell if it is 'running'?
If I open SQL2K5 Xpress, I can run queries against the db's & things look fine, but even if it is open, I still cannot connect VS2005.
Does SQL2005 actually need to be 'Open' to be running? I shouldn't think think so.
When I try another approach of adding a New Data Source from within VS2005 data sources tab, when I navigate to the MDF file & choose it then test the conenction , I get the error:
"Generating User instances in SQL2005 is disabled".
However I still get the error after running sp_Configure 'User instances enabled' SP.
Thanks for your ongoing help on this one. I just can't seem to get a conenction happening.
Maybe it's not possible to conenct to SQL2005 Express?
Thanks very much for your help here
@.nt
Tuesday, February 14, 2012
Connection String
Can VWD generate it by itself? I have a MDF file and I need to get the connection string.
What do you mean by generate it by itself?
||| Ok, forget generating itself, how do I make the connection string for a mdf?
Hi,
Form your description, it seems that you want to generate your connection string which links to a mdf file, right?
As for the "automatic way", do you mean an easy way to build the connection string? If so, you can use the connection builder to help you on creating the connection string. There are many ways to open the connection builder. i.e. Drag a SqlDataSource onto the webform, and configure the datasource, and click on "New Connection", and then you can select the server name, attach the database file, after that, click Ok, a new connection string would be added into Web.Config.
Thanks.
Sunday, February 12, 2012
Connection provider for DBF file
I already check every provider, but not found provider for DBF file.
Anyone can help me?
Hello,
When you create a data source, just use the provider "Microsoft Jet 4.0 OLE DB ..."
Then try a OLE DB Source or a Datareader source over the data source created.
Hope it helps
|||Hi!
You can download the FoxPro and Visual FoxPro OLE DB data provider from msdn.microsoft.com/vfoxpro/downloads/updates. It works for all versions of Fox tables.
|||Hi!
While the Jet OLE DB data provider will work for older Dbase IV formatted DBFs it will not work for Visual FoxPro tables. The FoxPro and Visual FoxPro OLE DB data provider works with all versions of FoxPro DBFs. As I said in my other post, it can be downloaded from msdn.microsoft.com/vfopxor/downloads/updates.
|||You're right.Thanks a lot.