Unable to save data in sql server 2005 through c#.NET coding - c#

I have a very unusual problem. I made a project in C#.net in vs 2008 and SQL server 2005.
I have two DB to use.
Now, the problem is whenrunning the project on my PC it works fine, but when i install on users PC, through setup, im getting a exception handler error , when im trying to save any data in either of the DBs. However i tried to insert data through INSERT INTO coomand in sql it works fine. And i have no problem in retrieving data.
So any one can help please do.
Thanks in advance

How are you specifying your connection to the database(s)? If you're doing windows authentication, most likely your user's accounts don't have permissions on the database. It could also be that they can't see the database from where they are on the network.
I'd start by pinging the DB server from the user's machine to make sure they can even access the server.

Related

ReportViewer and DataSets - Error while Installing on Other PC

Using: Microsoft Visual Studio 2010. SQL Server 2008. Report Viewer
2010
Hey everybody, hope you doin' great!, i'm actually having a hard time going through a complicated moment at my thesis developing.
Okay, let me explain it to you.
I designed reports on my software, on localhost they work perfectly but when I tried installing the software on other computer I'm getting an error when trying to open one of the reports.
The error is not controlled by the application, it says something like
"Error related to the network while trying to stablish a connection with the SQL Server, the server couldn't be found or it was unreacheable."
The thing is, on the form I got the report I'm Filling the ReportViewer with this.
this.UsuariosAtendidosTableAdapter.Fill(this.DB_SUBSIDIOS_MUNICIPALIDADDataSet.UsuariosAtendidos, fecha1, fecha2);
this.reportViewer1.RefreshReport();
DB_SUBSIDIOS_MUNICIPALIDAD is my Database.
UsuariosAtendidos is my Procedure.
fecha1, and fecha2 are the two needed fields to fill the stored procedure.
Moving on, on my RDLC I'm calling the stored procedure from a DataSet which provides of all the procedures.
The thing is that when installing it on other computer it seems like it CANT or its UNABLE to access that DataSet because its on my computer.
So the questions are:
How am I supossed to fill the report without using a local dataset?
PS: Sorry for my bad english, isn't my fluent lenguage.
You should also have a SQL Server instance with the database of interest on this another computer or you should change the connection string to point to your original computer, these two computers should be on the same network, SQL Server on the first computer must be started and available

C# SQL Server: Application works with database from another pc

I have my application written in C#, it uses a SQL Server database. I have a connection to a database in my C# code, some queries to write/read from database.
Now consider following: if I want to run this app from another PC, this PC has no SQL Server, will this app work? (I assume not) If not then how can this another PC still work with database? Is there a way to programmatically create database on another PC using C# so it has a name I need, columns I need. I created my database using SQL Server Management Studio.
I guess your application works with a local server.
First of all you should check in your application at startup if there is any local mssql server running. If not, you should handle it by installing one programmatically.
Read this answer how to do this if you don't know it.
After that you have to create the database, it's tables, maybe adding user priviliges. Write a SQL script that gets started by a class that starts it.
Read this to see how to start a SQL script in C#
You can do this by setting up SQL server on another machine (server).
Set that servers authentication to SQL Server authentication (requires username and password for that SQL server Management Studio)
Change the connection string in web/App.config from your C# app to use that servers Ip address and Credentails for SQL server

Connect via PHP to SQL Server 2012

My problem has a couple things:
I got a website constructed in joomla, hosted on linux server (that means that sqlsrv doesn't work because it's made for windows only, and the host administrator already informed me that they can't install any php extension).
I got a C# program, and my database is hosted on Amazon (SQL Server 2012).
To resume, i need to connect my website to my SQL database program to show data, and modify it, etc etc, on web.
So, if you guys have any ideia how can i make it, i really appreciate that.
Best regards,
Hélder Lopes
I recommend to install the php module :
source : http://technet.microsoft.com/en-us/library/cc793139(v=sql.90).aspx
source : http://www.php.net/manual/en/book.mssql.php
If there is no way, move your database to your website's hosting (converting db to mysql), and make your C# program use mysql and point it to the website database.
good luck.

Connection to MYSQL from visual c#

I'm not sure if this is the right place for this question, but here goes......I have a website that was developed in PHP using MYSQL. Now, I am wanting to write an application in Visual C# which accesses the MYSQL database, and returns data from that database to the application. I attempted this, and received the error "(xx.xxx.xxx.xx) is not allowed to connect to this MYSQL server". After some research, I found that there was a way to turn this off on the server by IP address. However, this application would eventually be distributed to other people and PC's, so I don't think this is a permanent solution. I think I could open the MYSQL database to the world, but I'm hoping for some way that I can connect to MYSQL and tell the server that I am coming from the hello world application only. Does anyone know if this is possible from Visual C# and MYSQL, or know of a secure way to connect to a remote website MYSQL database using an application that can have a dynamic IP address?
Thanks in advance!
Ramhound is right in that you need to reconfigure your server if you want to do anything like this, but if you want to connect to the server directly from the client applications, your client would need to have the password for your Mysql which is not ideal..
Instead you should set up a webservice on your database server, and use that to sent/receive data to and from the clients.

First time using security in ASP.NET

I have to do a homework where i have to implement user registration and login in ASP.NET.(Form-Based)
I am reading my book and it says that the first thing I should do is use aspnet_regsql.exe to configure, but when I went to pick the the database I get this error:
I keep trying to fix this problem, but I dont know how.
At this link I found a note that says:
The database elements that are
installed in the feature database will
always be owned by the SQL Server
database owner account (dbo). In order
to install the feature database, a SQL
Server login must be permitted to the
db_ddladmin and dd_securityadmin roles
for the SQL Server database. However,
you do not need to be a system
administrator for the SQL Server in
order to install the feature database.
I don't understand what I am missing.
-What should I do?
-Where can I find db_ddladmin and dd_securityadmin?
UPDATE
As the above step looks like is not able to find the database, i thought i better create it manually. so this is what i do
Step 1:
Step 2:
Why is this happening?
I just need to prepare my work enviroment to use form-based authentification. I cannot do my homework if i cant configure my working enviroment first. Can someone give me a hand to fix this? Does it have to do something with permisions or other?
You are getting the error because you're trying to connect to a server that doesn't exist. If you are using sql server express, your server name would be creator-PC/SQLEXPRESS.
I believe I remember having to do this too. http://support.microsoft.com/kb/914277. Follow the instructions under "Enable remote connections for SQL Server 2005 Express or SQL Server 2005 Developer Edition"
First thing you need to do is try to browse to the database itself. I use the sql server management studio to do this. If you are able to connect, then you will need to edit the user permissions, otherwise you probably have an issue with the sql server setup.
if you tried connecting using management studio to your DB server and if you are able to connect but you are not able to connect through asp.net application then there is a probability that the database does not have any permission for aspnet user so first create a new user in sql server for aspnet user and try again to connect using the wizard.
Generally the error comes when you not have your server started or installed on machine. Also Make sure the server instance is running and you place the right name of the server instance. if your sql server is configured to use sql server authentication then provide proper parameters i hope this all will help and get you out of it

Categories