Showing posts with label computers. Show all posts
Showing posts with label computers. Show all posts

Wednesday, March 21, 2012

create same Database connection on multiple computers

Hi,
is there a possibility to create automaticaly a ODBC database connection on
the multiple client computers (equal for all of them), in ex. on windows
2000 Profesional or XP?
And secont thing. Is there a possibility to automaticaly change all of the
ODBC connections without changing one by one?
Thanks for help.
Marcin
yes it is possible. Just create(or modify) the regkey from
HKEY_LOCAL_MACHINE
SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\
SOFTWARE\ODBC\ODBC.INI\
You can do very easy a program to do all this change. I've made one, and it
works well
Gabriel Anton
Software Developer
"#'ak" <mkrzyz@.beretta.pl> wrote in message
news:cgfjtn$4v3$1@.atlantis.news.tpi.pl...
> Hi,
> is there a possibility to create automaticaly a ODBC database connection
on
> the multiple client computers (equal for all of them), in ex. on windows
> 2000 Profesional or XP?
> And secont thing. Is there a possibility to automaticaly change all of the
> ODBC connections without changing one by one?
> Thanks for help.
> Marcin
>
sql

create same Database connection on multiple computers

Hi,
is there a possibility to create automaticaly a ODBC database connection on
the multiple client computers (equal for all of them), in ex. on windows
2000 Profesional or XP?
And secont thing. Is there a possibility to automaticaly change all of the
ODBC connections without changing one by one?
Thanks for help.
Marcinyes it is possible. Just create(or modify) the regkey from
HKEY_LOCAL_MACHINE
SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\
SOFTWARE\ODBC\ODBC.INI\
You can do very easy a program to do all this change. I've made one, and it
works well
Gabriel Anton
Software Developer
----
--
"#'ak" <mkrzyz@.beretta.pl> wrote in message
news:cgfjtn$4v3$1@.atlantis.news.tpi.pl...
> Hi,
> is there a possibility to create automaticaly a ODBC database connection
on
> the multiple client computers (equal for all of them), in ex. on windows
> 2000 Profesional or XP?
> And secont thing. Is there a possibility to automaticaly change all of the
> ODBC connections without changing one by one?
> Thanks for help.
> Marcin
>

Friday, February 17, 2012

Create Database using C#

Hi,
I write software in C# that should create (by itself) a new database.
The SQL server should be installed on the customer's computers silently
(I still need to figure how to do this part)
How can my software create a database that only it can access? Do I
need to create a special user account from the software?
What user account do I use to open a connection to the SQL server in
the first place when I create the database (taking under consideration
that the SQL server was installed silently and as far as the user
concern he has no idea my software uses SQL server).
To summarize:
1.The install of my software should install and configure the SQL
server silently (appreciate any help here)
2.The software needs to access the local SQL server and create a
database that only it can access when the software runs under a simple
"USER" account in Win2K/XP and not "ADMINISTRATOR" (my big problem -
any idea?)
Thanks in advance,
Oren
"orenbt78" <orenbt78@.googlemail.com> wrote in message
news:1164123542.578586.6280@.j44g2000cwa.googlegrou ps.com...
> Hi,
> I write software in C# that should create (by itself) a new database.
> The SQL server should be installed on the customer's computers silently
> (I still need to figure how to do this part)
> How can my software create a database that only it can access? Do I
> need to create a special user account from the software?
> What user account do I use to open a connection to the SQL server in
> the first place when I create the database (taking under consideration
> that the SQL server was installed silently and as far as the user
> concern he has no idea my software uses SQL server).
> To summarize:
> 1. The install of my software should install and configure the SQL
> server silently (appreciate any help here)
> 2. The software needs to access the local SQL server and create a
> database that only it can access when the software runs under a simple
> "USER" account in Win2K/XP and not "ADMINISTRATOR" (my big problem -
> any idea?)
> Thanks in advance,
> Oren
>
See
Embedding SQL Server Express into Custom Applications
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/emsqlexcustapp.asp
User Instances for Non-Administrators
http://msdn2.microsoft.com/en-us/library/ms143684.aspx
David
|||Thanx for the reply.
The "Embedding SQL Server Express into Custom Applications" seems to be
very helpful.
However, I can't figure out yet how to solve my problem with creating
databases as a simply user.
I plan to create a new database every year and let the user to view
last year's data while I am updating this year's data. That means 2
connections at the same time.
In the "User Instances for Non-Administrators" document it says "One
user can only have one user instance". So how can I do that?
And how do I do it in C# code?
Thanks again,
Oren
|||"orenbt78" <orenbt78@.googlemail.com> wrote in message
news:1164565596.943159.13410@.14g2000cws.googlegrou ps.com...
> Thanx for the reply.
> The "Embedding SQL Server Express into Custom Applications" seems to be
> very helpful.
> However, I can't figure out yet how to solve my problem with creating
> databases as a simply user.
> I plan to create a new database every year and let the user to view
> last year's data while I am updating this year's data. That means 2
> connections at the same time.
> In the "User Instances for Non-Administrators" document it says "One
> user can only have one user instance". So how can I do that?
> And how do I do it in C# code?
An instance is an instance of the database engine. A single instance of the
database engine can have multiple databases.
And in C# you just send TSQL commands using a
System.Data.SqlClient.SqlCommand object. You can get the syntax for the
commands from SQL Server Books Online.
TDavid
|||I have managed to create the database file (code below). I am not sure
it is the right way.
I would like to create a password for these database so only my
software will be able to control it (change data). how do i do that?
tmpConn.ConnectionString = "Data Source=(local); DATABASE =
master;Integrated Security=True; user instance=true";
sqlCreateDBQuery = " CREATE DATABASE " + DBParam.DatabaseName + " ON
PRIMARY "
+ " (NAME = " + DBParam.DataFileName +", "
+ " FILENAME = '" + DBParam.DataPathName +"', "
+ " SIZE = 5MB,"
+ "FILEGROWTH =" + DBParam.DataFileGrowth +") "
+ " LOG ON (NAME =" + DBParam.LogFileName +", "
+ " FILENAME = '" + DBParam.LogPathName + "', "
+ " SIZE = 1MB, "
+ "FILEGROWTH =" + DBParam.LogFileGrowth +") ";
SqlCommand myCommand = new SqlCommand(sqlCreateDBQuery, tmpConn);
try
{
tmpConn.Open();
MessageBox.Show(sqlCreateDBQuery);
myCommand.ExecuteNonQuery();
MessageBox.Show("Database has been created successfully!", "Create
Database", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString(), "Create Database",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
finally
{
tmpConn.Close();
}
|||anyone? any idea?

Create Database using C#

Hi,
I write software in C# that should create (by itself) a new database.
The SQL server should be installed on the customer's computers silently
(I still need to figure how to do this part)
How can my software create a database that only it can access? Do I
need to create a special user account from the software?
What user account do I use to open a connection to the SQL server in
the first place when I create the database (taking under consideration
that the SQL server was installed silently and as far as the user
concern he has no idea my software uses SQL server).
To summarize:
1. The install of my software should install and configure the SQL
server silently (appreciate any help here)
2. The software needs to access the local SQL server and create a
database that only it can access when the software runs under a simple
"USER" account in Win2K/XP and not "ADMINISTRATOR" (my big problem -
any idea?)
Thanks in advance,
Oren"orenbt78" <orenbt78@.googlemail.com> wrote in message
news:1164123542.578586.6280@.j44g2000cwa.googlegroups.com...
> Hi,
> I write software in C# that should create (by itself) a new database.
> The SQL server should be installed on the customer's computers silently
> (I still need to figure how to do this part)
> How can my software create a database that only it can access? Do I
> need to create a special user account from the software?
> What user account do I use to open a connection to the SQL server in
> the first place when I create the database (taking under consideration
> that the SQL server was installed silently and as far as the user
> concern he has no idea my software uses SQL server).
> To summarize:
> 1. The install of my software should install and configure the SQL
> server silently (appreciate any help here)
> 2. The software needs to access the local SQL server and create a
> database that only it can access when the software runs under a simple
> "USER" account in Win2K/XP and not "ADMINISTRATOR" (my big problem -
> any idea?)
> Thanks in advance,
> Oren
>
See
Embedding SQL Server Express into Custom Applications
http://msdn.microsoft.com/library/d...>
xcustapp.asp
User Instances for Non-Administrators
http://msdn2.microsoft.com/en-us/library/ms143684.aspx
David|||Thanx for the reply.
The "Embedding SQL Server Express into Custom Applications" seems to be
very helpful.
However, I can't figure out yet how to solve my problem with creating
databases as a simply user.
I plan to create a new database every year and let the user to view
last year's data while I am updating this year's data. That means 2
connections at the same time.
In the "User Instances for Non-Administrators" document it says "One
user can only have one user instance". So how can I do that?
And how do I do it in C# code?
Thanks again,
Oren|||"orenbt78" <orenbt78@.googlemail.com> wrote in message
news:1164565596.943159.13410@.14g2000cws.googlegroups.com...
> Thanx for the reply.
> The "Embedding SQL Server Express into Custom Applications" seems to be
> very helpful.
> However, I can't figure out yet how to solve my problem with creating
> databases as a simply user.
> I plan to create a new database every year and let the user to view
> last year's data while I am updating this year's data. That means 2
> connections at the same time.
> In the "User Instances for Non-Administrators" document it says "One
> user can only have one user instance". So how can I do that?
> And how do I do it in C# code?
An instance is an instance of the database engine. A single instance of the
database engine can have multiple databases.
And in C# you just send TSQL commands using a
System.Data.SqlClient.SqlCommand object. You can get the syntax for the
commands from SQL Server Books Online.
TDavid|||I have managed to create the database file (code below). I am not sure
it is the right way.
I would like to create a password for these database so only my
software will be able to control it (change data). how do i do that?
tmpConn.ConnectionString = "Data Source=(local); DATABASE =
master;Integrated Security=True; user instance=true";
sqlCreateDBQuery = " CREATE DATABASE " + DBParam.DatabaseName + " ON
PRIMARY "
+ " (NAME = " + DBParam.DataFileName +", "
+ " FILENAME = '" + DBParam.DataPathName +"', "
+ " SIZE = 5MB,"
+ " FILEGROWTH =" + DBParam.DataFileGrowth +") "
+ " LOG ON (NAME =" + DBParam.LogFileName +", "
+ " FILENAME = '" + DBParam.LogPathName + "', "
+ " SIZE = 1MB, "
+ " FILEGROWTH =" + DBParam.LogFileGrowth +") ";
SqlCommand myCommand = new SqlCommand(sqlCreateDBQuery, tmpConn);
try
{
tmpConn.Open();
MessageBox.Show(sqlCreateDBQuery);
myCommand.ExecuteNonQuery();
MessageBox.Show("Database has been created successfully!", "Create
Database", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString(), "Create Database",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
finally
{
tmpConn.Close();
}|||anyone? any idea?

Create Database using C#

Hi,
I write software in C# that should create (by itself) a new database.
The SQL server should be installed on the customer's computers silently
(I still need to figure how to do this part)
How can my software create a database that only it can access? Do I
need to create a special user account from the software?
What user account do I use to open a connection to the SQL server in
the first place when I create the database (taking under consideration
that the SQL server was installed silently and as far as the user
concern he has no idea my software uses SQL server).
To summarize:
1. The install of my software should install and configure the SQL
server silently (appreciate any help here)
2. The software needs to access the local SQL server and create a
database that only it can access when the software runs under a simple
"USER" account in Win2K/XP and not "ADMINISTRATOR" (my big problem -
any idea?)
Thanks in advance,
Oren"orenbt78" <orenbt78@.googlemail.com> wrote in message
news:1164123542.578586.6280@.j44g2000cwa.googlegroups.com...
> Hi,
> I write software in C# that should create (by itself) a new database.
> The SQL server should be installed on the customer's computers silently
> (I still need to figure how to do this part)
> How can my software create a database that only it can access? Do I
> need to create a special user account from the software?
> What user account do I use to open a connection to the SQL server in
> the first place when I create the database (taking under consideration
> that the SQL server was installed silently and as far as the user
> concern he has no idea my software uses SQL server).
> To summarize:
> 1. The install of my software should install and configure the SQL
> server silently (appreciate any help here)
> 2. The software needs to access the local SQL server and create a
> database that only it can access when the software runs under a simple
> "USER" account in Win2K/XP and not "ADMINISTRATOR" (my big problem -
> any idea?)
> Thanks in advance,
> Oren
>
See
Embedding SQL Server Express into Custom Applications
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/emsqlexcustapp.asp
User Instances for Non-Administrators
http://msdn2.microsoft.com/en-us/library/ms143684.aspx
David|||Thanx for the reply.
The "Embedding SQL Server Express into Custom Applications" seems to be
very helpful.
However, I can't figure out yet how to solve my problem with creating
databases as a simply user.
I plan to create a new database every year and let the user to view
last year's data while I am updating this year's data. That means 2
connections at the same time.
In the "User Instances for Non-Administrators" document it says "One
user can only have one user instance". So how can I do that?
And how do I do it in C# code?
Thanks again,
Oren|||"orenbt78" <orenbt78@.googlemail.com> wrote in message
news:1164565596.943159.13410@.14g2000cws.googlegroups.com...
> Thanx for the reply.
> The "Embedding SQL Server Express into Custom Applications" seems to be
> very helpful.
> However, I can't figure out yet how to solve my problem with creating
> databases as a simply user.
> I plan to create a new database every year and let the user to view
> last year's data while I am updating this year's data. That means 2
> connections at the same time.
> In the "User Instances for Non-Administrators" document it says "One
> user can only have one user instance". So how can I do that?
> And how do I do it in C# code?
An instance is an instance of the database engine. A single instance of the
database engine can have multiple databases.
And in C# you just send TSQL commands using a
System.Data.SqlClient.SqlCommand object. You can get the syntax for the
commands from SQL Server Books Online.
TDavid|||I have managed to create the database file (code below). I am not sure
it is the right way.
I would like to create a password for these database so only my
software will be able to control it (change data). how do i do that?
tmpConn.ConnectionString = "Data Source=(local); DATABASE =master;Integrated Security=True; user instance=true";
sqlCreateDBQuery = " CREATE DATABASE " + DBParam.DatabaseName + " ON
PRIMARY "
+ " (NAME = " + DBParam.DataFileName +", "
+ " FILENAME = '" + DBParam.DataPathName +"', "
+ " SIZE = 5MB,"
+ " FILEGROWTH =" + DBParam.DataFileGrowth +") "
+ " LOG ON (NAME =" + DBParam.LogFileName +", "
+ " FILENAME = '" + DBParam.LogPathName + "', "
+ " SIZE = 1MB, "
+ " FILEGROWTH =" + DBParam.LogFileGrowth +") ";
SqlCommand myCommand = new SqlCommand(sqlCreateDBQuery, tmpConn);
try
{
tmpConn.Open();
MessageBox.Show(sqlCreateDBQuery);
myCommand.ExecuteNonQuery();
MessageBox.Show("Database has been created successfully!", "Create
Database", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString(), "Create Database",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
finally
{
tmpConn.Close();
}|||anyone? any idea?