|
Is it better to create a database on my PC and include it into the installation package or should I rather create the DB in code, when the application is run for the first time? It is a Windows desktop appliacation.
So far, I have included the DB into the installation and when there was an upgrade, only the new fields have been checked/added to the tables.
Now I was thinking if it would be a better idea to create the whole database in code at startup:
1) Check if the DB exists. If not, create it.
2) Check if all the tables exist. If not, create them.
3) Check if all the fields in all tables exist. If not, create them.
What do you think?
Thanks,
Petr
|
|
|
|
|
I've had the installer create the database from scripts in the past. It worked well for me.
|
|
|
|
|
Hi,
I have been used sql for my VC++. NET apps’ database. I want to make app that more than one user can use it from a shared hdd via network. E.g. let the app is on computer A, a hdd will be shared via network on computer A, and Computer B will use app via Computer A.
After configuring .NET Framework settings with CasPol.exe, app is working. But whenever it try to reach database, this error occurs: “The file” \\....” Is on a network path that is not supported for database files. An attempt to attach auto-named database for file “\\...” failed. A database with the same name exists, or specified file cannot be opened, or its located on UNC share…”.
Both of computers (A and B) have SQL Server 2005 Express Edition. At first i use Windows Auth. For login but after i had this error, i tried to make app use “Mix mode” and login as “sa 12345”. I changed Sys. Admin. Pass as “12345” and set “remote connections” settings to “TCP/IP”.
How can i solve this problem? Or how do the apps which has same strategy as this app work? Can you help me ? Thanks…
Erman
|
|
|
|
|
SQL Server, even Express edition, expects to have complete control of the file. It doesn't expect changes to be made from under it - it aggressively caches portions of the file so it doesn't need to read from the disk file, and makes changes in RAM and lazily writes them back to disk, to consolidate write operations (and thereby reduce the amount of writing it has to do). It explicitly doesn't support data files on the network as the network redirector introduces additional performance issues.
SQL Server does support opening files on a Storage Area Network, but the Logical Unit Number (virtual disk) that the files are on must be dedicated to that SQL Server, unless using SQL Server clustering.
If you need multiple clients to share the same database, you need a database server.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
If i attach mdf to Computer A's SQL Server manually then i make a constr for it without "|DataDirectory|" and Computer B runs exe via Computer A, will it work ?
|
|
|
|
|
Aloha,
All my rows have a column called "CM" with an int value. I would like to find the 3 rows where CM is as close as possible to CM in a specific row.
An example:
----
I have a row where CM is 120. I now want to find the 3 rows where CM is as close as possible to 120.
The 3 rows with the closest match would for example be 110, 125 and 130 if there are 10 rows and CM in those rows are: 80, 90, 100, 110, 120, 125, 130, 140, 150 and 160.
----
Anyone know how I can do that with a SQL SELECT?
Thanks, Mads
|
|
|
|
|
Declare @number as int;
Set @number = 120;
Select top 3 CM, abs(CM-@number) FROM tblMgtTest
where CM <> @number order by abs(CM-@number);
Do good and have good.
|
|
|
|
|
Hi,
What is the difference between the following to stored procedures:
aspnet_Membership_GetUserByName
aspnet_Membership_GetUserByUserId
I am using my own custom membership provider. I had to override the GetUser method and I just want to the user details, and not sure what stored procedure to use, I assume the aspnet_Membership_GetUserByName stored procedure?
Can someone also explain to me what the @UpdateLastActivity input parameter is and when to set it?
Thanks
Brendan
modified on Tuesday, March 11, 2008 2:43 AM
|
|
|
|
|
Let me think....
If you have these procs in your SQL Server, can't you look at them ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Select @total=total+@total,@month=@month + [month] + ' ' + Cast(@total as varchar(6)) + ',' from CummSum
Then you have to split the value with comma and spaces
Best Regards,
Chetan Patel
|
|
|
|
|
Hi Friends,
I am having problem with extracting data from a field which has datatype text in sql server 2005. Following is the two sample rows which contains the field.
1.
TrackID14910417OrderID1019RefReason1019Src21244700309600019SID13640214PayCh13MJA210PurchaseID10218
2.
TrackID145493211Description235USE+IT+UP+AND+WEAR+IT+OUT+-+ODYSSEY17OrderID10210PurchaseID1019RefReason10214PayCh13MJA16UserID23642B942B8-05D0-4447-BEEC-7EF11419368B217CVFDate1019SID13640213TID1019Dst21244700059600
I want to extract TrackID value from above two rows, the length of the values may vary, it might be 8,9 or 10 digits long.
Shahzad Aslam
Software Engineer
Softech Systems Limited
Email: shehzadaslam@hotmail.com
|
|
|
|
|
I guess you need to pull out ten characters, and then parse them. In future, perhaps you can think of a more sensible format
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
yes 10 characters needed and then need to parse them, it could be a sensible format in the future but currently we have to continue with this..
Shahzad Aslam
Software Engineer
Softech Systems Limited
Email: shehzadaslam@hotmail.com
|
|
|
|
|
Hi,
I am planning to develop a web application by ASP.NET on document management for commercial distribution. The target customers are middle size companies
and they will host their own applicaton servers.
I am now considering using which backend server database for development
and deployment. The candidates are MySQL, Interbase and Firebird.
My questions are as follow,
1. Are MySQL and Interbase are free for commercial distribution ?
(I only know that firebird is free, and MySQL and Interbase are open-source)
2. Coz firebird is free for commerical distribution, is it good enough as backend server for mid-sized company usage ?
3. From view of performance only, which one is the best ?
4. From view of performance combined with cost, which one is the best ?
Thanks
|
|
|
|
|
MySQL is not free for commercial use, AFAIK
I would say write standard SQL and test with all three to see which performs best for you.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
A couple things I'd LOVE to see Microsoft, if not ANSI, add to SQL.
#1
Select As Elements<br />
*<br />
From<br />
Elements;
Since SQL Server and VS.NET 2005 were released basically as sister projects, this would have been wonderful for queries that returned more than one table. The tables in a DataSet get called, by default, Table, Table2, Table3, etc. You can override this using the DataTableMapping class, but having it named in the query could also be useful.
#2
Select<br />
*, -ID, -Name<br />
From<br />
SomeTable
This would select all columns, except for ID and Name. Normally, it is bad practice, as most developers know, to use Select *. However, if you're writing a proc that must work on a table that is passed in by name, for instance, you either have to use Select *, or query the INFORMATION_SCHEMA for the necessary columns. The above syntax, I think, is much nicer.
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|
I'm trying to write datetime's to an access DB. I can read them using an oleDbDataAdaptor and a dataset created from it, but when I write new values back to the DB only the date value is sent and the time is set to midnight. When debugging I can see the dataset is storing both the date and time values within my C# application, but only the former is being written into the DB itself.
Otherwise [Microsoft is] toast in the long term no matter how much money they've got. They would be already if the Linux community didn't have it's head so firmly up it's own command line buffer that it looks like taking 15 years to find the desktop.
-- Matthew Faithfull
|
|
|
|
|
Solved by changing the type of the fields in the parameter collection for each query from OleDbType.DBDate to OleDbType.Date
Otherwise [Microsoft is] toast in the long term no matter how much money they've got. They would be already if the Linux community didn't have it's head so firmly up it's own command line buffer that it looks like taking 15 years to find the desktop.
-- Matthew Faithfull
|
|
|
|
|
Hi,
Please look at the following piece of code from a strored procedure:
CREATE PROCEDURE dbo.aspnet_Membership_CreateUser
@UniqueEmail int = 0
Does this mean that if @UniqueEmail is not supplied it will add a 0 to that table field?
Thanks
Brendan
|
|
|
|
|
.NET Enthusiast wrote: CREATE PROCEDURE dbo.aspnet_Membership_CreateUser
@UniqueEmail int = 0
Does this mean that if @UniqueEmail is not supplied it will add a 0 to that table field?
I think you have your terminology wrong. This code has nothing to do with fields (columns) on tables.
If you call the stored procedure and you do not supply a value for the @UniqueEmail parameter then it will be replaced with 0. If you supply NULL as the parameter value it remains null.
|
|
|
|
|
Hy,
I hope this is the place where to post my problem. I didn't see a specialized forum for Sql Reporting Services. So here goes.
I have to create a report, rdl file. The report shows a few statistics for a period of time. I passed, the parameters, showed the data, everything. Now the only thing left is to modify the report to show the statistics for one month on a page. To give an example: I want to see the statistics from 1st of march to the 21st of april. The report should have 2 pages: a page for the month of march and one page with statistics from 1st of april to the 21st.
I tried google, MSDN, and stil couldn't find a solution to this problem.
Any hint is welcomed.
Thanks
PS: I'm using SQL Server 2005 and VS 2003
I will use Google before asking dumb questions
modified on Monday, March 10, 2008 8:59 AM
|
|
|
|
|
Have you tried using a datalist to repeat your data based on the month?
|
|
|
|
|
Hey,
Thanks for the reply. I have tried a data list, but to be sincerely I don't know how to filter the data based on the month. Can you give me a small example? Thanks
I will use Google before asking dumb questions
|
|
|
|
|
Thanks a lot. Cheers. It works just fine. 5 from me
I will use Google before asking dumb questions
|
|
|
|