DataSource Controls :: Write The Connection Code And Cofigure SQL Server To Use The Programe In Internet?

Oct 14, 2010

i am using sqlserver 2008

in my computer, sql server name is "LOCALHOET-PC" AND SECOND ONE "LOCALHOST-PCSQLEXPRESS"

I have write a code in my software like

SqlConnection conn;
conn = new SqlConnection("Data Source=LOCALHOST-PC;Initial Catalog=n4netsALT;Integrated Security=sspi");
conn.Open();

and it is working working smoothly in my computer

View 2 Replies


Similar Messages:

DataSource Controls :: Internet Connection Loss While Executing Query?

Jun 23, 2010

I am having problem in diffrentitate error between internet connection loss error and Other Error in query for example: duplicate record found.

Both the error fall into System.Data.SqlClient.SqlException category.

But the way to handle both this 2 error is different.For connection error , i need to bring user to connection loss page while for duplicate record found error, i need to show the user a pop up.

Unless i do a checking exactly on the error message , else i have no ways to differentiate connection loss error and any other error. Am i correct for this?

View 1 Replies

DataSource Controls :: Test Sql Connection From Localhost To Internet Host?

May 21, 2010

Can you test your connection from localhost to internet host Sqlserver Database

View 4 Replies

DataSource Controls :: Connecting To SQL Server In Visual Studio 2008 Using Code - Error: 25 - Connection String Is Not Valid

Feb 2, 2010

Background: I use SQL server 2005 developer edition and visual studio 2008. Visual studio 2008 is running on a local machine with Vista business edition. SQL server is running on a remote server using Windows server 2003. Both computers are within the same domain.

Problem: First, I used the server explorer to connect to the SQL server. Everything works as desired. Then I write code to do the same thing. I keep getting the following error message:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)

However, I used the exactly identical connection string as the one used in the server explorer. So connection string should not be the problem. In addition, I tried the test code in MSDN, which tells whether my domainusername can flow the network. It turns out the user name is fine. I also went to the SQL server management studio and found the login for my computer is NVCWeihao while my computer login name is NVCweihao. I am wondering if this uppercase letter really affects the connection.

View 2 Replies

Code To Write In Web.config For The Connection String For DB Connectivity?

Feb 6, 2010

what code should i write in web.config for the connection string for DB connectivity woth ado.net component??

View 2 Replies

DataSource Controls :: To Write Safe Code Sqlcommand.ExecuteNonquery?

Jan 6, 2010

how to write code for database transaction(eg; Insert,delete,update) i want to write a better code

eg:sqlcommand.Commandtext="some sql insert query";

sqlcommand.parameter.Add(new sqlparameter("@cmdname","someValue"));


sqlcommand.ExecuteNonquery();

how to write the above code in better and safe way, i am expecting .net master also answer this question

put his view(pros and cons)

View 2 Replies

DataSource Controls :: How To Use Server.MapPath As Datasource While Creating Connection With OLEDB

Nov 15, 2010

i am trying to create connection using OLEDB connection in my app. but i am not able to create the connection as in datasource i want to use Server.mappath, but cudn't find the right method to use it. i am trying to make connection with Access database file. following is code i have tried:

string path = Server.MapPath("~/uploadaccess/Production.mdb");
string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb")&";";
and also
OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path&";");
and tried this
OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb"));

and this is the error i am getting:

Operator '&' cannot be applied to operands of type 'string' and 'string'

View 3 Replies

DataSource Controls :: How To Convert, The Code To Query A SQL Database Using A DSN-less Connection

Sep 10, 2010

How do we convert, the following code to query a SQL database with ASP using a DSN-less connection

[Code]....

View 2 Replies

DataSource Controls :: Error Occurred While Establishing A Connection To SQL Server - The Server Was Not Found

Mar 5, 2010

Not sure why it works if i connect to SQL 2005 on another server, but now that i have SQL Express on the same server as the pages, im getting the following error: I have attached my connection string within my web.config and also how its being called within the code behind. Now this page was written by another programmer some time back.. so not sure if the method he used to do this is the best or only way. But i have connected to other SQL database with other applications with alot less code.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)


Source Error: Line 131:
Line 132: //connect to this sql server
Line 133: c.Open(); -----> this is the line it complains about.[Code]....

View 8 Replies

DataSource Controls :: Error 40 - Could Not Open A Connection To SQL Server

Jan 8, 2010

I have an application with a few dbml files to connect to several sql servers in order to import data from one to another using Linq to SQL.

There are 2 connection strings with integrated security and in one I provide user ID and password.

It all works great in the development workstation. I've then wrapped the dll project and deployed the asp.net application to a test server. Then, when I tried to run the application to import the data, I got a connection exception:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

I figured out after some debugging the problem is with the DataContext whose connection string is the one I provide user ID and password. Now, the funny part is that the same connection string works if I create a udl file and test it. And again the same connection string works with my development workstation.

View 4 Replies

DataSource Controls :: How To Write A Method That Uses SQLParameter To Insert Some Data Into SQL Server

Jun 30, 2010

I am about to write a method that uses SQLParameter to insert some data into SQL server. However, do I "have" to specify a DBType? If not how is this handled?

Here is an example of the code I intend to write:

[Code]....

View 6 Replies

DataSource Controls :: How To Write Query Using Pivot Logic In Sql Server 2005

Jan 7, 2010

i have a table for customer forecast which contains customer, week number and quantit as columns. now i need to write query and list the week as column for each customer and each cell should have a quantity. how to write query for this using pivot logic. i dont want to use cursor.

View 3 Replies

DataSource Controls :: Connect Sql Server 2005 Through OBDC Connection

Apr 13, 2010

I try to connect sql server 2005 through OBDC connection bt i face a error, i face this error

ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. ERROR [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()).

OdbcConnection conn = new OdbcConnection("Driver={SQL Server};Server=test;UID=sa;PWD=java;");// test is my ODBC connection name
string query = "INSERT INTO test VALUES ('" + textBox1.Text + "','" + textBox2.Text + "')";
OdbcCommand cmd = new OdbcCommand(query, conn);
try
{
conn.Open();
cmd.ExecuteNonQuery();
MessageBox.Show("Record Inserted.");
}
finally
{
conn.Close();
}

View 1 Replies

DataSource Controls :: Linking Database Connection To Online Server?

Feb 4, 2010

My website is working but when I host it up, the connection are all screw up. Is it because my connectionString are all linked via SqlDatasource and is for local files only? Whats the coding that I need to put in so that my site will connect to the database via accessing the web.config or server?

View 11 Replies

DataSource Controls :: MS SQL Server ... Version / Installation And More Importantly Web Connection

Jan 5, 2011

I am having trouble installing SQL Server on my system ... it appears to install ok but when I try to connect it using Visual Web Developer Express 2008 it will not connect and mentions something about versions. I downloaded the Northwind database to carry on with the tutorials .. this also asked me to download the MS SQL 2000 version which I tried and this also did not work, other versions include 2005 and 2008. When I tried to open the program through the programs file from "Start Menu" only the configuration manager folder is there.

I have also tried to install the trial version from the website but to no avail. Each time I have restored to factory settings on my laptop and it still fails to connect. I notice that when I restore to factory settings there are loads of icons where the uninstall window lists all of the programs and there is still SQL Server 2008, lots of Icons. I think that version 2008 came with the laptop as it is a business sony vaio sr vgn-sr46gd model with vista business.

View 1 Replies

DataSource Controls :: How To Write A Sql To Execute The File At Specific Time Sql Server Database

May 28, 2010

how can i write a sql to execute the file at specific time sql server database.

View 3 Replies

Forms Data Controls :: Write A Code For Displaying A Files And Folders Of Server Directory Using Grid View In .net?

Jun 12, 2010

how can we write a code for displaying a files and folders of server directory using Grid View in asp.net?

View 3 Replies

DataSource Controls :: Connecting Sql Server / To Read The Windows User Account  Name And Pass In The Connection

Apr 6, 2010

I would like to do a connection of asp.net page with Sql Server. Here I would like to read the Windows user account name and pass in the connection.The connection should be Windows authentication. IIS server and Sql server are installed in different machine. Here I am able to connect locally, When I am running from server, It takes windows account of Server.

so i can read local account(Where user is accessing the web application) and make windows authentication sql server connection.

View 3 Replies

DataSource Controls :: Login Failed For User '(null)'. Reason: Not Associated With A Trusted SQL Server Connection.

Mar 3, 2010

I am trying to use Windows Authentication in my asp code. I have read / tried all answers on the web but couldnt my page to connect to sql. I m using classic asp.

My conn string looks like :

OCONN.OPEN ("PROVIDER=SQLOLEDB; DATA SOURCE myserver; INITIAL CATALOG=nrth; Integrated Security=SSPI; trusted_Connection=yes")

but I mgetting error

Microsoft OLE DB Provider for SQL Server

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.error '80004005'

View 6 Replies

DataSource Controls :: Connect To Different Data Providers (Oracle And SQL Server) Using Single Connection String?

Jun 29, 2010

How to connect to different data providers(Say Oracle and SQL Server) using single connection string?

View 1 Replies

DataSource Controls :: Connection Pooling And Check Connection State?

Apr 7, 2010

In my DAL i have more than 100 methods/Function, each and every method am opening the sqlconnection and closing the connection, this is taking too much of time to establish the connection at every time. So what i expect is one common class will create the SqlConnection that will check if the connection is Broken or Closed then create the connection again else return the connection, how to do this(Also i would like to apply ConnectionPooling).

View 7 Replies

Web Forms :: Change Database Connection From SQL Datasource To Code Behind

Feb 10, 2012

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$appSettings:ConnString%>" SelectCommand="sql query ............."

This is in design and with the above I have

 SqlDataSource1.SelectCommand = "sql query ............. " in code behind

but if i have the connection in code behind. How do I execute

SqlDataSource1.SelectCommand == "sql query ............. "

It without any reader or dataset...

View 1 Replies

SQL Server :: Write Code Of Stored Procedure / Create Stored Procedure And Write Select Statement In It

Nov 23, 2010

how can I create stored procedure and write my select statement in it, I know how to create dataset then put type stored procedure and assign it to the sp ... what I want is writing my sp... how can I make it ?

check the following code, this is what I want to write put I don't know where or how !

CREATE STORED PROCEDURE SP_CATEGORY

@CATEGORY VARCHAR(30)

AS

BEGIN

SELECT LATIN_NAME, ENGLISH_NAME, ARABIC_NAME, CATEGORY

FROM FLORA, CATEGORY_LIST

WHERE FLORA.CATEGORY=CATEGORY_LIST.CATEGORY_NAME AND CATEGORY_LIST.CATEGORY_NAME IN (SELECT * FROM SPLITLIST(@CATEGORY, ','))

END

where can I write this code ?!

View 5 Replies

DataSource Controls :: 2147467259/A Network-related Or Instance-specific Error Occurred While Establishing A Connection To SQL Server

May 21, 2010

I am using Asp.Net MVC 2.0 for creating a user and assigning properties to the user at the same time. I am using my Windows account to access database on my local computer. I am using pre-installed MVC code o create a user with unique user name and password. User is created OK. Then I want to add profile properties like First and Last name at the same time.

I am creatingProfileBase object:

ProfileBase profileBase = ProfileBase.Create(profileInformation.UserName);

where profileInformation is a RegisterModel and has user info.

When I am trying to:

profileBase.SetPropertyValue(.....);

I am getting the following error # 2147467259 A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Shared Memory Provider, error: 40 - Could not open a connection to SQL Server)"}

Why is my connection string works fine the first time and not working now? And how to configure connection to use TCP-IP?

I have SQL Server Browser running ander Local account and openned port in my Firewall.

View 4 Replies

C# - Establish Connection Between 2 Computers On Internet

Dec 28, 2010

I am having a domain name and web space (the web is running, its ASP.net 3.5). I am working on a project in which I need to connect 2 computers over the internet.

Is it possible to do that with a simple ASP.Net website? What other things I do need to do this?

EDIT
Actually I want to send the data from one computer to another in real time, I mean as we do chatting we exchange text to one another. The same thing I want to achieve.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved