Showing posts with label path. Show all posts
Showing posts with label path. Show all posts

Friday, March 9, 2012

localhost

i have a path line in my code, now, i have in the path \\"computername"\sharename\... what i need to do is instead of the "computername", i need to put a variable there to pick the localhost name where the code is runing on.If you're not running a named instance, you could use
declare @.path varchar(255)
select @.path = @.@.servername + '\\sharename'
select @.path
"IT" <anonymous@.discussions.microsoft.com> wrote in message
news:25BA2799-65BB-467A-8F46-39F732B0FB36@.microsoft.com...
> i have a path line in my code, now, i have in the path
\\"computername"\sharename\... what i need to do is instead of the
"computername", i need to put a variable there to pick the localhost name
where the code is runing on.|||SQL Server should handle the word localhost and/or (local) for the server name. Did you try that? If
you want to extract the machine name, you can use the SERVERPROPERTY function (read about it in
Books Online).
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"IT" <anonymous@.discussions.microsoft.com> wrote in message
news:25BA2799-65BB-467A-8F46-39F732B0FB36@.microsoft.com...
> i have a path line in my code, now, i have in the path \\"computername"\sharename\... what i need
to do is instead of the "computername", i need to put a variable there to pick the localhost name
where the code is runing on.

localhost

i have a path line in my code, now, i have in the path \\"computername"\shar
ename\... what i need to do is instead of the "computername", i need to put
a variable there to pick the localhost name where the code is runing on.If you're not running a named instance, you could use
declare @.path varchar(255)
select @.path = @.@.servername + '\\sharename'
select @.path
"IT" <anonymous@.discussions.microsoft.com> wrote in message
news:25BA2799-65BB-467A-8F46-39F732B0FB36@.microsoft.com...
quote:

> i have a path line in my code, now, i have in the path

\\"computername"\sharename\... what i need to do is instead of the
"computername", i need to put a variable there to pick the localhost name
where the code is runing on.|||SQL Server should handle the word localhost and/or (local) for the server na
me. Did you try that? If
you want to extract the machine name, you can use the SERVERPROPERTY functio
n (read about it in
Books Online).
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=...ls
erver
"IT" <anonymous@.discussions.microsoft.com> wrote in message
news:25BA2799-65BB-467A-8F46-39F732B0FB36@.microsoft.com...
quote:

> i have a path line in my code, now, i have in the path \\"computername"\sharename\... what
i need

to do is instead of the "computername", i need to put a variable there to pi
ck the localhost name
where the code is runing on.

Friday, February 24, 2012

local database in c#

Hi,

I want to create a database in a path specified by the user at runtime when he selects a menu item like File/New. My preference is to not require the user to run an sql server on his machine to run my application. All my searches on the web for this keep directing me to the code that creates a database on an sql server but I don't want that. I want the application to create the database at runtime at a place where the user chooses. I would appreciate either a snippet of code or a link to somewhere helpful please.

Hi,

MS Access is the solution for u. It does not require any extra files to work. It just need MDAC to be installed and it's shipped with Windows.

All u have to do is to create ure database with all tables, views,... with no data. Ship the empty database with ure application and when the user wants to create a new database u just copy the empty database to the user location.

HTH.

Hayder Marzouk

|||Thanks Hayder.

If there is a way to do this with a local sql database, I would appreciate some sample code to see how to do it.
|||

Hi,

You may create a T-SQL script and then run the script to create a database.

Move from C# express forum to Sql server forum.

Thanks

|||

Not within your specified 'requirements'

My preference is to not require the user to run an sql server on his machine to run my application.

A 'Local' sql database will require that the user run or have access to a SQL Server.

As Hayder mentioned, an Access database is an excellent option and does not require that the user have access to, or install a SQL Server.