installshield projects runtime error - c#

I've created a project in installshiel program uses SQL Server 2008 and written in C#.
Everything works fine and scripts of database also works fine but I had error when trying to install program which is created by installshield
error is
Error 27506. Error executing SQL script db_name.sql. Line 9
The CREATE DATABASE statement failed. The primary file must be at least 3
MB to accomodate a copy of the model database. (1803)
I tried to search in google but I couldn't find any results
please help

There is absolutely nothing wrong with the installer. It's doing exactly what it was told to do: Execute a SQL script that was injected into it and report any errors that occur.
You didn't actually provide the contents of the SQL but basically you need to look at the CREATE DATABASE statement paying attention to the SIZE, MAXSIZE and FILEGROWTH arguments.

Related

Visual Studio is trying to connect SQL database while loading a solution. Gives error: Cannot open database requested by the login

I've got a Visual Studio solution on which I had been playing with few C# projects related to Entity Framework coding.
I was creating some test databases to connect to and learn db first and code first approach. The problem is now every time I try to open the solution containing those projects, for some weird reason Visual Studio, or the solution or some project in it tries to connect to those databases. It gives an error as I've deleted those databases:
Cannot open database "Company" requested by the login. The login
failed. Login failed for user "administrator".
Here is the error message snapshot:
I get this error one by one for several databases. But I'm wondering why would VS try to connect to some database just while loading the solution? In case anyone else has faced this situation or know the reason behind it then that will be really great.
Note: The tags in the question I've put is only due to the environment I was working into. I'm trying to reach to a point to figure out if my problem is specifically related to those areas.
TL;DR; Delete the inactive/invalid SQL Server connections marked with a red cross in the Server explorer window of Visual Studio to get rid of the issue. SQL Server connections become invalid/stale whenever you delete the corresponding database from SQL Server but Visual Studio doesn't know about it and keeps trying unnecessarily.
Details: As correctly suggested by #stuartd, the Server Explorer in Visual Studio was messing up. Posting the answer in case it helps anyone else as well.
I realized that every time I was adding an ADO.NET Entity Data Model file for Entity Framework into my project as shown below it was adding a SQL connection node in Server Explorer window as shown below.
The connection was corresponding to the DB I chose in the ADO.NET entity data model addition wizard. I see that there is red cross against few of them since I've deleted the databases from SQL Server instance. Whenever you load a solution Visual Studio will always try to refresh the connection of all the databases currently found in Server Explorer. In fact in the case of DBs which have a red mark against them (as they are deleted) I'm sure VS must be employing the retry logic as well while trying to make a connection with the database. All this takes and wastes time as far as the loading time of a solution is concerned.
How to resolve the error: I deleted the inactive/unused connections marked with a red cross to get rid of the issue. It will be great if someone knows a way to mark the connections as inactive i.e. the connections live in the Server Explorer but VS shouldn't try connecting them every time until I ask it to refresh or may be it can refresh when I expand its node.
I also observed that Visual Studio somehow maintains these server explorer connections on a per solution file basis, may be in *.suo files. I had to delete those stale connections after opening every solution which were facing this error related to DB connection issue while getting loaded in Visual Studio. All solutions facing this issue somehow had at least one project related to entity framework :).

SQLite C# and Firefox Manager

I am writing a small library that all it does is opens a connection with the local SqliteDb present just near the application and reads from the database depending on the search query.
The one using this library does not need the access to Insert or update any record but are updated from lets say me.
SO to create a database i use this:
SqlConnection = new SQLiteConnection("Data Source=Languages.db;Version=3;New=True;Compress=True");
Than to access the database the same but New=False
Now i am using Firefox Sqlite Manager to modify the table such as creating the structure and adding values.
But when i save the file with firefox i get an error on C# stating that it is write/read protected when i try to open the connection!!
Edit: I also tried to use Sqlite Browser: http://sqlitebrowser.org
but then i got that unsupported file format!
Am i missing something?
Regards
The FireFox SQL Lite Manager when open, restricts other applications from making a connection to the SQL Lite database. If you shut down the FireFox Manager, your C# code will execute correctly.
You can refer this answer to understand the nature of the lock applied by Firefox Firefox locks places.sqlite
I have noticed that when creating a table or altering the table somehow from the SQL manager gui, the gui itself creates some headers/meta data that the driver is not able to read and thus it flags it as corrupted.
To solve the issue all i had to do is create the tables and alter as necessary from my application directly,than i can add records using the firefox manager and it seems to be working correctly!
Correct me if im wrong!

Release plan for my application on other machine by using .mdf file

I am using SQL server 2008 R2 and VS2010. I made simple application by using this tools. I attach database as .mdf in my application and deploy that application on other machine its works fine. Now if I plan for new release of my app which some extended features, I can upload Code by DLL, But problem is updating .mdf file, to handle this I am exporting database into .xls sheets (Application have one utility to backup database) and then import into SQL Server to create new .mdf file. Someone have better solution on this? Can I open old version of .mdf file in SQL Server(Third party software) and Execute DML/DDL script on it to make latest code and database compatible ? May I keep .sql file in one of my project code and execute it by some utility..? Any Class in C# which can handle this..?
I did not get your query completely. Do you want to upgrade the DB through the application?
You can of course run .sql files through your application, but I'm not sure it would help you change the Database configuration.
Alternatively, if you already have the updated .mdf file and the database name is same, then you can follow the following steps.
1. Detach the database by SSMS in the third party environment through SSMS.
2. Replace the .mdf, .ldf and .ndf (if any) in the disk.
3. Attach the updated .mdf file.
This will get the new Object definitions as well as data.
As far as I'm aware, there is no process for merging .mdf files, because the SQL Server might not be able to identify the similar objects properly as sys tables may be different, and also would not know which data to keep in the final data base, in case the table structure, constraints or data conflicts occur.
However, looking at your requirement, the best way I can suggest is,
1. Generate the Alter scripts for the tables modified (By right clicking on the object name and using Script Table As.. option). Of course, I assume you have the list of objects modified and the modifications.
2. Connect the two DB servers over network and write an SSIS package or Import data from the old DB to the new one for the tables you want.
Hope this helps.

Running the ADO.net program at regular interval

I have a sql serevr database in a remote system .I am using ADO.net to bring that database table values into my local mysql server .
Now i want to fetch data from remote db into my local db every 15 min .I think this will involve running the program every 15 min.Please suggest if there is any better way .I want to make it automatic.
I tried with putting the package.dtsx in schedule task . It doesnt work .I think we can make an exe file and then run it
Can you tell me how do i make an exe file?
How do i do this.
Thanks
Since you've tagged your question with Visual Studio 2008, I'll assume you have that.
Create a new project of type Console Application. If you add your code to that project and compile it, the result will be a .exe file which you can run as a Scheduled task.
However, since you are talking about a .dtsx package, another option would be to add your .dtsx package as a scheduled job in the server you are trying to import data to.
Read this on how you schedule a job in SQL Server.

Foxpro - Error 15: "Not A Table"

I'm working on a C# application that reads/saves data in some old dbf-files.
(using Microsoft Visual FoxPro - driver)
I haven't had any problems until recently, when i tried querying a table i had'nt used before and i got this error message. This table is somewhat special since it has 500+ columns, i suspect that this might have something to do with it - but nothing I've googled so far gives any indications to this causing any problems.
I've had a look at this document and checked that the header record count matches the actual count (1 record);
This document is the only good tip I've found so far, that does not require any heavy dbf-repair tools.
I've tried using both the Microsoft Visual FoxPro - and the VFPOLEDB driver, they both give more or less the same error message.
I've tried passing the TableValidate = 0 command, without success.
Does anybody have any experience with a way to solve/work around this, preferably using C#.
VFP tables don't support 500 columns, so this isn't a VFP table. You need to find out what kind of table it is and use the appropriate driver to open it.
If the table is damaged, you can use CmRepair.app to fix it. This program is a Visual Foxpro 8 application (not a compiled .EXE), so you need VFP to execute it.
If you don't have VFP installed, you can download an utility program I made to execute VFP scripts and .APPs in customers that haven't VFP installed. The VFP8 runtimes are available here. Then you run the program with runner CmRepair.app and repair the table.
Good luck!
From the comment from Tamar, it got me to thinking of yet another application database that used .DBF file formats... Clipper. Here's a link that describes their table capacities..
Apollo database - (Clipper)
This might be a missing link you are looking for.

Categories