|
Hello, This is Vikash Gohil.
I have a Software which is using MSDE Database (SQL2000).
When the Software is run for the first time, it checks for the database name and if not found attaches the MDF and LDF files that are present in the "<Application Path>\Data" folder.
I don't face any problem in this setup.
Now I want to move from MSDE (SQl2000) to SQLExpress (SQL2005).
I Created the MDF and LDF Files, Installed SQLExpress and My Software.
After this I Copied the MDF and LDF Files in "<Application Path>\Data" Folder.
The problem is, when I start the Software the database files are attached, but it shows below message:
"Failed To Update Database "<DatabaseName>", the Database is Read-Only."
And the software does not start.
I want to know why this happens?
I do not face such problems in MSDE.
I have Searched for this on net and found that the SqlExpress should have rights for the folder where MDF and LDF Files Exists. But I don't know how to Set rights for my "Application Path\Data" Folder.
I am totally new to SQL 2005.
Please someone can help me in this matter.
Any help would be greatly appreciated.
Awaiting a reply, Thanks in Advance.
|
|
|
|
|
Check the dumb things first.
Are the files/folder read only
Does your app have permissions on the folder (some companies set admin rights to the program files folder)
Have you set up the user correctly
Is your connection string correctly formatted
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello, MyCroft.
Thanks for the reply.
Are the files/folder read only?
When I put the same files in the folder where system database files are present, i.e. Master, Model, etc., and then manually attach these files using Sql express Management studio, then there is no problem.
The problem of Read-Only occurs only when data files are present in some other folder.
Does your app have permissions on the folder?
During Installation of the software, we have set the permissions as Everyone, so I don't think that is the problem. Also we have been using this with MSDE the same way and there are no problems.
Have you set up the user correctly?
We Use default 'sa' user for making connections.
Also the ConnectionString is absolutely proper as it works fine with MSDE.
|
|
|
|
|
Ok so the dumb ones are covered. It still looks like 1 is the cause of the problems. If you move to another folder and attach the files does the connection work OK then. I don't use express but with SQL Server the server instance has an identity/credentials and these are used to access the file system. I would presume permissions on the data/log folders is set up on install of the database. Other folders may need specific permissions.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi All,
I have one Excel sheet "Student.xls", which has different worksheet as "Sheet1","Sheet2"..like that.
Consider now "Sheet1"; it has 3 columns - "Name", "Age", "Sex". All these columns has row entries.
Now I have one access database, "alldata.mdb". It has One table "Record" which has 3 fields as same as column name of Excel sheet-- "Name", "Age", "Sex".
I want to populate this access database with the entries of Excel sheet from "Sheet1".
Can someone let me know how to do this?
I tried this:
// first connected xl datasheet:
Dim filename As String = "C:\Student.xls"
Dim con As String
con = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & filename & ";" & "Extended Properties=Excel 8.0;"
Dim connection As OleDbConnection = New OleDbConnection(con)
connection.Open()
The above Excel connection was succesful, but how to import the data from this excel sheet into the access database.
Please suggest.
Thanks,
R.S.
|
|
|
|
|
Select * FROM [Sheet1$]
or however your query looks like.
Enter the data into a dataset. Open a new connection to the alldata.mdb and copy the data from the dataset.
"When did ignorance become a point of view" - Dilbert
|
|
|
|
|
Hi,
I have copied the data in a new dataset "ds1". Please tell me how to copy this "ds1" contents into Access Database. I am trying with following:
Dim da2 As New OleDbDataAdapter
Dim conn As OleDbConnection
Dim cmd As OleDbCommand = New OleDbCommand()
conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\alldata.mdb;")
cmd = New OleDbCommand("SELECT * FROM Denver", con)
da2 = New OleDbDataAdapter(cmd)
da1.Fill(ds1, "Denver")
But not able to populate the excel sheet.
Can You guide me how to do this??
Thanks,
R.S.
|
|
|
|
|
Sorry By mistake.... I made the statement
"But not able to populate the excel sheet."
What i was:
"But Not able to populate the Access Database".
Thanks
R.S.
|
|
|
|
|
hi dearest brothers/sisters
i have created trigger in MSSQL SERVER.
CREATE TRIGGER IDx on Table2 after INSERT
AS
insert into Table2 (RefNo) select RefNo from Table1
i need Table2 Foreign key RefNo to be filled no of times which means
eg. table2 may need RefNo to be filled in three rows.
currently i get single row others kept NULL values
help me plz
thanks
so much of happy ending...
|
|
|
|
|
|
Thanks Mohsiul Haque . its really helpful and learned some.
so much of happy ending...
|
|
|
|
|
Triggers are EVIL. Although this is a valid use of a trigger I would suggest using a normal stored proc and surrounding the inserts with a transaction.
Begin Tran
insert parent record
get scope_identity for the inserted record
begin a loop
insert the number of records in the child tables
end the loop
commit the transaction
return the id to the calling method
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks to Mycroft Holmes . its really helpful !
so much of happy ending...
|
|
|
|
|
A query that used to take milliseconds is now taking 3 seconds to run
The table only has 7000 records and I rebuilt the one index that it uses
I am thinking if I drop/create the table the problem may get fixed, but the table has several dependent views, etc. Will each dependent item need to be created again?
Thanx,
>>>-----> MikeO
|
|
|
|
|
|
In MS SQL Server Management Studio,
1) create a new query
2) paste the query in the query window
3) under the Query menu select the option to "Include Actual Execution Plan"
4) Execute the query.
Check out the execution plan results and you want to avoid "scans", this means that it is reading the table or index sequentially.
Also under the Query menu, choose the "Include Client Statistics" and check those values for anything that may seem out-of-whack.
Pleasse reply to this posting so that I know if this was helpful.
david
|
|
|
|
|
I followed the steps in your reply. Nothing looks to be wrong with the query. It even appears to execute normally in Management Studio. When I execute it in the code on the client though it takes about three seconds.
The client app has been running successfully for about four years. Now it is getting bogged down by two queries. Both do field sums. Any ideas what could change on a server or connection that would slow down a SUM operation?
This is a close approximation of the query that is taking so long:
SELECT SUM(WorkSecs) as WorkTime, SUM(RunSecs) as RunTime
FROM tblData WHERE Machine = 1 and Operator = 1
Thanx,
>>>-----> MikeO
|
|
|
|
|
I need to know how to archive data from particular database when it is growing above 1GB.Also it has to be restored when it was needed.Any Idea
|
|
|
|
|
For most of the time Archiving database can be done by using SQL Jobs, I think at first you need to create a stored procedure which will fetch the data and dump into the archive database and then just call it from SQL Jobs with a given schedule.
|
|
|
|
|
There's no "archiving" in SQL Server, there's only "backup" and "replication".
|
|
|
|
|
You are asking for a strategy to manage your data, you are not going to get a satisfactory answer in a forum post.
Most archiving is done by time stricture, anything that is 2 yo move to the archive database. This type of process requires that you copy (replicate) the data into an identical database and delete it from the production DB. Here you run up against data structure issues, all your chages to production structure needs to be reflected in the archive data.
Queries can be written across both databases, but these are specific to archived results.
Another strategy is data warehousing your data. You need to do some serious research into your business requirements before deciding on an archiving strategy.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi all
i have a table with the PrimaryKey of AutoNumber
so i want to insert a row and retrieve it`s PrimaryKey !!!
by the way my DBMS is MSAccess 2003
can any one help me about this?
|
|
|
|
|
You can't really make the insert query return anything else then the number of affected rows.
You will have to follow your insert statement with a select statement.
Something like:
INSERT INTO Table1 (Field1) VALUES('blablabla')
SELECT MAX(PrimaryKeyField) FROM Table1
My advice is free, and you may get what you paid for.
|
|
|
|
|
No, no no. Really that is about the worse way you can retrieve the inserted key.
|
|
|
|
|
sometimes several people, several apps are operating on the same database table. At the same time.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|