Click here to Skip to main content
15,884,099 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionwebparts - catalog - referencing a single instance Pin
SteveBradwell21-Oct-09 4:05
SteveBradwell21-Oct-09 4:05 
QuestionHow to pass SoapHeader in .NET 2.0 for authentication to AXIS web service Pin
ajay_sp00221-Oct-09 3:18
ajay_sp00221-Oct-09 3:18 
AnswerRe: How to pass SoapHeader in .NET 2.0 for authentication to AXIS web service Pin
Not Active21-Oct-09 4:15
mentorNot Active21-Oct-09 4:15 
QuestionHow do I delete item on a Repeater control? Pin
tunsten21-Oct-09 3:08
tunsten21-Oct-09 3:08 
AnswerRe: How do I delete item on a Repeater control? Pin
Not Active21-Oct-09 4:14
mentorNot Active21-Oct-09 4:14 
GeneralRe: How do I delete item on a Repeater control? Pin
tunsten21-Oct-09 6:43
tunsten21-Oct-09 6:43 
GeneralRe: How do I delete item on a Repeater control? Pin
Not Active21-Oct-09 6:52
mentorNot Active21-Oct-09 6:52 
Questionsql connection string Pin
geek_master21-Oct-09 2:52
geek_master21-Oct-09 2:52 
Hi,

I am a newbie in asp.net. I am trying to connect a sql database with my web page. I have got a checkbox and a button on the page, once the check box is checked and the button is clicked the page should show the data that I want from the database table. I have written so far the following codes.

<

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
if (CheckBox1.Checked)
{
SqlConnection conn = new SqlConnection("user id = user;" +
"password = pass;" +
"Data Source = local host"); //making the connection string

conn.Open(); //opne the connection
SqlCommand cmd = new SqlCommand("SELECT (id, name) FROM customer", conn);//sql query
conn.Close();//close the connection
}
}
}

>


It doesn't work. I get the following error msg.

<

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)

>

The datasouce is not right ! D'Oh! | :doh: . I would really be appriciated if some can give an idea how can I fix it or the way I am trying to do it if it's right. Many thanks in advance.

Smile | :)
AnswerRe: sql connection string Pin
Covean21-Oct-09 3:11
Covean21-Oct-09 3:11 
QuestionRegarding pop-up page Pin
vijaylumar21-Oct-09 2:16
vijaylumar21-Oct-09 2:16 
AnswerRe: Regarding pop-up page Pin
dan!sh 21-Oct-09 2:27
professional dan!sh 21-Oct-09 2:27 
AnswerRe: Regarding pop-up page Pin
Anurag Gandhi21-Oct-09 5:57
professionalAnurag Gandhi21-Oct-09 5:57 
QuestionPage Expand or Page Middle [modified] Pin
Nanda_MR21-Oct-09 1:47
Nanda_MR21-Oct-09 1:47 
AnswerRe: Page Expand or Page Middle Pin
dan!sh 21-Oct-09 2:29
professional dan!sh 21-Oct-09 2:29 
GeneralRe: Page Expand or Page Middle Pin
Nanda_MR21-Oct-09 18:50
Nanda_MR21-Oct-09 18:50 
AnswerRe: Page Expand or Page Middle Pin
Rob Branaghan21-Oct-09 4:46
Rob Branaghan21-Oct-09 4:46 
GeneralRe: Page Expand or Page Middle Pin
Nanda_MR21-Oct-09 21:25
Nanda_MR21-Oct-09 21:25 
QuestionFinding control object from javascript [modified] Pin
bhavnvyas20-Oct-09 23:21
bhavnvyas20-Oct-09 23:21 
AnswerRe: Finding control object from javascript Pin
Abhijit Jana20-Oct-09 23:25
professionalAbhijit Jana20-Oct-09 23:25 
GeneralRe: Finding control object from javascript Pin
bhavnvyas20-Oct-09 23:40
bhavnvyas20-Oct-09 23:40 
QuestionStop published web application from working Pin
samerh20-Oct-09 22:23
samerh20-Oct-09 22:23 
AnswerRe: Stop published web application from working Pin
Abhijit Jana20-Oct-09 23:12
professionalAbhijit Jana20-Oct-09 23:12 
QuestionJava Script Problem: Code is working fine in Mozila 3.5 But NOt Working in Mozila 2.0 & Shafari Pin
krishnaveer20-Oct-09 21:48
krishnaveer20-Oct-09 21:48 
AnswerRe: Java Script Problem: Code is working fine in Mozila 3.5 But NOt Working in Mozila 2.0 & Shafari Pin
Abhishek Sur20-Oct-09 22:04
professionalAbhishek Sur20-Oct-09 22:04 
GeneralRe: Java Script Problem: Code is working fine in Mozila 3.5 But NOt Working in Mozila 2.0 & Shafari Pin
krishnaveer20-Oct-09 23:24
krishnaveer20-Oct-09 23:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.