473,771 Members | 2,357 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Database creation in SQL 2005 from C# - works from one computer, not the other

18 New Member
Was hoping someone could give me some things to check here - I'm trying to figure this one out.

I've got a SQL connection string in an INI file, it is read into my C# .NET console app and connects to the database fine from my workstation. It processes the SqlCommand statements I use to drop the table (if it exists) and re-create it, and does an Insert statement to fill one row, and quits. This all works fine from my workstation (running XP) when ran on the command line.

When I copy it over to our IIS server (running W2K3) and run it the same way, using the same INI file, same DB connection string to hit the same SQL server it was able to create the DB on before, it does not work. Any thoughts on why this might happen? I'm logged in as me on both my workstation and the server, and my account has DB creation and admin rights on the SQL server. I have another console app on the IIS server that can hit that SQL server fine. At a loss here.

Thanks,
Tom
Aug 17 '09 #1
5 1988
tlhintoq
3,525 Recognized Expert Specialist
it does not work.
A bit vague.

Logging. It's hard to create *too much* logging in a program. Give your program a ton of logging. I'll bet that most of your methods do a "console.writel ine()" from when you were building and debugging it, so you could see where something worked and didn't. Those things are a good start on what to write to a log file.

I'd bet it will come down to something simple and easy to overlook like an extra '\' in a path etc. But it will be hard to find unless you log attempts and responses:

12:31.123: Attempt to connect to "http:\\mydatab ase.sql"
12:31.666: Connection failed: "wrong password"
Aug 17 '09 #2
navyjax2
18 New Member
Thanks for the quick response. Yeah, I agree that was a little vague.

What I meant to say is that my program seemed to go through all of the motions, but not create the database or tables. I thought my "Console.WriteL ine" statements completed as they should, but it turned out I did need more in there - I had them before and after the call to the class that contains the SqlCommands that create the tables, before, and these would write fine. So I put them right after the ExecuteNonQuery statements on my SqlCommands that created the tables, and these DID NOT write. I have it write the error from any SqlException that could come up to the Event Log, but nothing gets written. What would cause the tables not to write, but no exception to be raised?

Thanks,
Tom
Aug 18 '09 #3
tlhintoq
3,525 Recognized Expert Specialist
So I put them right after the ExecuteNonQuery statements on my SqlCommands that created the tables, and these DID NOT write.
I'm going to guess some exception occured and the code aborted, so it didn't make it to the line writing the error condition.

What would cause the tables not to write, but no exception to be raised?
Invalid path
Invalid command
Aug 18 '09 #4
navyjax2
18 New Member
The ExecuteNonQuery statements are inside of a try...catch, so if there was an exception raised, the event would be logged since the EventLog routine is inside of my catch (wouldn't it?). I know the SqlCommands are valid since they will write the tables when the app is run from my workstation. All I'm doing is moving the app from my workstation to a server - I keep everything the same (connection string in the INI file, other INI settings). What could cause it not to perform the table creation SqlCommands from the server when it can do them from the workstation? Are there client-side OS settings that should be re-configured or something?

Thanks,
Tom
Aug 19 '09 #5
navyjax2
18 New Member
Actually I figured out later it involved the accounts I was running the app under. On my local dev machine it was running under my service account's privileges. When I moved it to the server, I found out it was under the Network Service account, not carrying over the service account's privileges due to a double-hop issue. Surprised it didn't raise a security exception, but it didn't. So it was a lot more complicated than just not writing to the Event Log or console. I solved it by impersonating the service account before it opened the database connections.
Jul 26 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

10
3799
by: John Bunch | last post by:
I have installed Visual Studio 2005 Team Suite Beta 2, including SQL Server 2005 Express Edition April CTP, on Windows XP Professional SP2, including IIS 5.1. The SQL Server (SQLEXRPESS) service is running under the NT AUTHORITY\NETWORK SERVICE account. This machine is named VSDev01WSWP01. I am also running SQL Server 2000 on a Windows Server 2003 computer named VSDev01SQL02. This computer contains my application's database, which I...
12
2121
by: dennist685 | last post by:
How to get an Access database on the web from my own computer I have an Access database project in inetpub/wwwroot/Access2 . I build it, and then press cntrl-F5. - I still get the development server - Version Information: ASP.NET Development Server 8.0.0.0, instead of IIS. This is a serious problem. How does one get an Access database on the web, using one's own computer(I have windows xp pro).
4
2012
by: robert d via AccessMonster.com | last post by:
When my app starts up, it creates a temporary database. This temp database is created from a 'model' database that is in the same folder as the application. Because there is a model, the creation is essentially to just copy the 'model' database and give it the name of the application with the extension ".tmp". Then code opens the temp database and links to the tables. This has always worked flawlessly until today. Today, I needed to...
0
1611
by: Jonathan Wood | last post by:
I seem to be having errors creating and accessing an SQL database. Unfortunatley, I am brand new to SQL setup and administration issues so this really is not my area of expertise. I know I had to install some type of IIS component to run databases from Visual Studio 2003. Since then, I've installed Visual Studio 2005. I know VS 2005 has some component so that IIS is not required. Here's the two errors:
2
2094
by: Tor Inge Rislaa | last post by:
Database on remote server On the remote server where my ASP.NET application is located there is no SQL Server or SQL Server Express. When I test my application locally it works fine because I have the SQL Server Express 2005 on my computer, but when I deploy it I am getting error message telling me that there are some problems connecting to the database. I have done the preparation on my SQL Server to allow remote connection to the...
0
1363
by: jsaccomanno | last post by:
NeoEdge Networks www.neoedge.com We're looking for a Senior Database Administrator, for our office in Toronto, Ontario Canada. Position Description · Responsible for ongoing development and tuning of Data Tier Databases (MS SQL Server 2005) and the C# API to the database Experience managing large scale, high concurrency, live, production
0
1593
by: Orgil | last post by:
Hi all, I have just writing a program named "DayBook". I am using MS Access 2003 database and Microsoft .NET C# 2005 (with framework 2.0). MS Access 2003, MS .NET C# 2005 and dotNetFramework2.0 are installed on my computer on which I have made my program. My program uses many queries. But the first query string, executed when program begins, is : "SELECT , , FROM ".
8
2836
by: BD | last post by:
I am developing C# win form app to work with remote database on SQL Server 2005. Problem scenario is as follows: 1. a form is open that has downloaded dataset to local cache 2. computer is put into stand-by or hibernation 3. later, computer is brought out of stand-by or hibernation 4. when trying to save or close form, SQL exception comes up (remote system closed conn) I know this relates to connection pooling, but I am having a...
31
3416
by: Tom P. | last post by:
I am doing quite a bit of custom painting and it means I have to create a lot of brushes (think one for every file system object in a directory) per paint. How expensive is this? Should I find a way to create the brushes once, store them in an member variable, and use them when I need them? Or is creating brushes a throw-away process that doesn't take a lot of work? Thanks for the info. Tom P.
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10102
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9910
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.