|
So you're saying that you want to install an application that was written for MSSQL, but not use MSSQL as the database engine?
|
|
|
|
|
I'm not really getting you here, but i think you might want to look at NHibernate and the DAO design pattern[^] to implement a datalayer on your application that abstracts the actual access to the data.
The client will still need drivers installed on their machines to allow them client access to whatever DB you decide to use...
|
|
|
|
|
if I try to explain: the application will use MS SQL server but I want that, in my install CD, when installing the application, the engine be insatlled with but not Entreprise manager and the other SQL application that I don't need to use my application. Only the engine
|
|
|
|
|
Is this being installed on the server? I don't think you can redistribute the SQL server engine (without getting a slap from MS) and i have no idea how... If you are installing on client machines, then all they need is the client drivers (ADO/ADO.net), which pretty much all Windows based machines will have.
Apart from that, I don't know and it's Friday afternoon...;P
|
|
|
|
|
If I'm installing it on the client machine, how can I write the sqConn.ConnectionString? because in it we have only the name of the database and not the full path of the file?
|
|
|
|
|
Well you should have it so it is configurable (i.e in .config file) and then during your installation you'll need to provide the user some way to enter the path to the DB which you then translate to connection string and save in your config.
I'm not a windows app programmer, but if you post this in the C# forum, you might get a more informative answer (about installers, etc.).
|
|
|
|
|
Well, what I know about MS SQL Server Desktop is that if you want to use it you must register first(you need a passport account) in order to have permissions. Even you if find a way to hide the set up process you need to ask the user to register.
However, I don't think there's way to hide the installation process of SQL Server Desktop...
|
|
|
|
|
How can I get the SQL server version from the code ?
|
|
|
|
|
usid this query "select @@version"
Last modified: 02-June-2006 3:32:18 AM --
|
|
|
|
|
Hi,
I have a relativley large/complex typed dataset that contains 7-8 tables and some supporting relational tables (lookups) for many-to-many relations. A good exampel would be a dataset that contained the whole Northwind database with all tables and relations.
In my business logic I will retrive a populated instance of the dataset and perform some operations (adding/deleting/updating of rows in various tables...).
What is the best way to persist these changes back to the database (SQL Server)?.
Regards
Shine
|
|
|
|
|
This sounds like a good case for middleware. If you're using .NET, this is easy and fun.
Typed DataSet objects are probably the best way to do this. If you craft your SQL queries correctly, or, better yet, use stored procedures, you should be able to use DataReader objects to populate typed DS objects directly (and back). In development, using SQL Server's XML services and DataSet.ReadXml() and WriteXml() may provide you with good tracing and an idea of what's going into and coming out of your database.
|
|
|
|
|
Hi,
I have never written a trigger before. This is probably very simply, but I need some assistance:
The basic concept is as follows. When user puts values into Table One, a TRIGGER occurs and values are automatically put into Table Two:
Table One has 3 basic columns, and Table Two has 2 basic columns.
Table One
NumStart: 1
NumEnd: 3
Code: A
Table Two
Num: 1
Code: A
Num: 2
Code: A
Num: 3
Code: A
Thank you in advance for any help you can give.
Anne
|
|
|
|
|
Anne,
(I'm assuming SQL Server 2000.)
It looks like you're trying to insert and expand in the trigger. The body of the trigger has access to a table called "inserted" that contains the inserted values. Inserting is easy, but running your expansion is more difficult and poor form in a set-based language like SQL.
This does what you want:
<br />
create trigger mytrigger on tableone for insert as<br />
begin -- trigger<br />
<br />
declare<br />
@ptr int, -- your loop variable<br />
@code char -- what to insert each time<br />
<br />
-- probably can combine the next two lines if clever<br />
select @code = code from inserted<br />
select @ptr = numstart from inserted<br />
<br />
while @ptr <= (select numend from inserted)<br />
begin -- while<br />
<br />
-- consider a select .. into instead of next<br />
insert into tabletwo (num, code) values (@ptr, @code)<br />
select @ptr = @ptr + 1<br />
<br />
end -- while<br />
<br />
end -- trigger<br />
The motherhood-and-apple-pie stand on this, all else being equal, is that you should use neither a trigger nor the second table for this. It says that you should always avoid triggers unless there's no other solution (there is here), and you shouldn't store your data twice (table two simply repeats information you can find in table one). Instead, you should just store the start, end, and code, and craft a query that will give you a result set containing (1, A), (2, A), (3, A) that runs every time you want that result. I'm assuming you have a good business case for this though, like a performance enhancement or something.
Stephan
|
|
|
|
|
I have created a C# (.NET 2.0) database application working with SQL Server 2000. In my application I make use of the SQLDMO object of SQL Server. When i deploy my application, i have problems when it tries to load the SQLDMO object! And the application fails and also notifies me that the RPC service isn't available! With my application, i have also deployed ALL dependencies (including the Interop.SQLDMO.dll assembly)! Does anyone know what might be the problem here?
|
|
|
|
|
SQLDMO is ONLY loaded if you have installed the Sql Server tools on the computer.
In order to use SQLDMO on a desktop, you MUST have a license for it.
|
|
|
|
|
SQL Server is installed and licensed on the target machine! For that reason, i do not include the actual SQLDMO.dll file in the installation package. I only include the Interop.SQLDMO.dll assembly which is required to communicate with the SQLDMO Com object. And still, i'm having problems on the target machine!
|
|
|
|
|
I want to load a Datatable from a database in my application. While loading the data, i want to show
a progressbar.
How can i realize it ?
|
|
|
|
|
Hi,
I didn't tried this before, but I think one possible solution is to use the TableNewRow-event. This event will be fired every time a new row is inserted into the datatable. What you can do is to register for this event (at the datatable) and then within the handler you can update your progressbar.
Hope this helps.
Regards
Sebastian
|
|
|
|
|
Thank you for the Tip, but it doesn't work, because i created the database-application with the Designer and so, the datatable is private. I only have access the bindingsource- and the datatableadapter.
|
|
|
|
|
hi,
I am using SQLXML 3.0 SP3 to put the data from an XML file to Database tables.I have to create a document specifying the various bugs that can be reported while using SQLXML 3.0...I searched a lot on web but till now no proper information.
Could someone help me out in this regard..
thanx
punam
|
|
|
|
|
Hi ,
i have a key that migrate from a table reserver to an other table reservation
that mean i have a forieng key called N°Reser in the reservation table
well , now i want that this N°Reser displayed just once in the reservation table
i meant 1 reserver can do 1,1 reservation can you tell me how should i do that in sql ??
because the default relashion gave me 1,n
thank you very much
try to be good if you can't be the best
|
|
|
|
|
Mohammed Amine wrote: because the default relashion gave me 1,n
n can represent 0, 1 or many. If you want to force a one-to-one relationship then you can put a second relationship in place 1-to-many going in the opposite direction. If you have two tables with a one-to-many and a many-to-one between them they end up forcing a one-to-one. (Actually, not quite - You can have a zero on one side, i.e. one-to-zero)
I'm curious. Why do you need a foreign key? Surely the primary key of of both will be the same?
one-to-one relationships can also be symptomatic of two tables that ought to be one table. Have you explored this possibility?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
can you tell me please how can i attach a database to the server just with code ?? i use VS 2003
i have the two files Mdf & Ldf one & i want to attach them to the server just with code
thank you very much
try to be good if you can't be the best
|
|
|
|
|
same command which is used in T-SQL to attach DataBase use in ur application.
It's pretty easy
|
|
|
|
|
SQL Server Books Online
sp_attach_db
Attaches a database to a server.
Syntax
sp_attach_db [ @dbname = ] 'dbname'
, [ @filename1 = ] 'filename_n' [ ,...16 ]
Examples
This example attaches two files from pubs to the current server.
EXEC sp_attach_db @dbname = N'pubs',
@filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf',
@filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs_log.ldf'
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|