Click here to Skip to main content
15,892,746 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Date Pin
Christian Graus13-May-07 1:31
protectorChristian Graus13-May-07 1:31 
GeneralRe: Date Pin
doWhileSomething13-May-07 7:41
doWhileSomething13-May-07 7:41 
QuestionAsynchronous calls B/W two .NET objects Pin
Sathiyaraj Ganesan13-May-07 0:15
Sathiyaraj Ganesan13-May-07 0:15 
AnswerRe: Asynchronous calls B/W two .NET objects Pin
Christian Graus13-May-07 1:37
protectorChristian Graus13-May-07 1:37 
GeneralRe: Asynchronous calls B/W two .NET objects Pin
Sathiyaraj Ganesan13-May-07 2:10
Sathiyaraj Ganesan13-May-07 2:10 
Questionopening my ASP.Net Pages from ColdFusion Pages?? Pin
Nada Adel13-May-07 0:06
Nada Adel13-May-07 0:06 
AnswerRe: opening my ASP.Net Pages from ColdFusion Pages?? Pin
Christian Graus13-May-07 12:20
protectorChristian Graus13-May-07 12:20 
QuestionASP.net C# whats up with this error? Pin
netwearcdz112-May-07 12:32
netwearcdz112-May-07 12:32 
Smile | :) Hey all,
What is up with my code here that is generating this error?

using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Collections;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Web.UI.HtmlControls;<br />
using System.Data.SqlClient;<br />
<br />
<br />
    /// <summary><br />
    /// Demonstrates how to work with SqlConnection objects<br />
    /// </summary><br />
    class SqlConnectionDemo<br />
    {<br />
    static void Main()<br />
    {<br />
        // 1. Instantiate the connection<br />
        SqlConnection conn = new SqlConnection("Data Source=;Initial Catalog=SupportIIS;User ID=sa ;Password=password");<br />
<br />
        SqlDataReader SupportIIS_rdr = null; <br />
<br />
        try<br />
        {<br />
            // 2. Open the connection<br />
            conn.Open();<br />
<br />
            // 3. Pass the connection to a command object<br />
            SqlCommand cmd = new SqlCommand("select * from ", conn);<br />
<br />
//TEST<br />
            // 1. Instantiate a new command with a query and connection<br />
            SqlCommand cmd = new SqlCommand("select CategoryName from SupportIIS", conn);<br />
<br />
            // 2. Call Execute reader to get query results<br />
            SqlDataReader SupportIIS_rdr = cmd.ExecuteReader();<br />
<br />
<br />
//TEST END<br />
            // get query results<br />
            SupportIIS_rdr = cmd.ExecuteReader();<br />
<br />
            // print the CustomerID of each record<br />
           while (SupportIIS_rdr.Read())<br />
				{<br />
					// get the results of each column<br />
					string categories1 = (string)SupportIIS_rdr["Categories"];<br />
					string MonthYear1 = (string)SupportIIS_rdr["MonthYear"];<br />
					string repeatCall1 = (string)SupportIIS_rdr["repeatCall"];<br />
<br />
					// print out the results<br />
					Console.Write("{0,-25}", categories1);<br />
					Console.Write("{0,-20}", MonthYear1);<br />
					Console.Write("{0,-25}", repeatCall1);<br />
					Console.WriteLine();<br />
                }}<br />
            finally<br />
        {<br />
            // close the reader to pervent buildup of readers?<br />
            if (SupportIIS_rdr != null)<br />
            {<br />
                SupportIIS_rdr.Close();<br />
            }<br />
<br />
            // 5. Close the connection<br />
            if (conn != null)<br />
            {<br />
                conn.Close();<br />
            }<br />
        }}<br />
    }<br />
  }<br />
}<br />


Error is the following:
Error	1	Type or namespace definition, or end-of-file expected	c:\inetpub\wwwroot\SQLConnectionTest\SQLConnection.aspx.cs	75	3	http://localhost/SQLConnectionTest/<br />


Any idea?

Thnx
AnswerRe: ASP.net C# whats up with this error? Pin
Fred_Smith12-May-07 12:43
Fred_Smith12-May-07 12:43 
GeneralRe: ASP.net C# whats up with this error? Pin
Colin Angus Mackay12-May-07 12:51
Colin Angus Mackay12-May-07 12:51 
GeneralRe: ASP.net C# whats up with this error? Pin
Fred_Smith12-May-07 13:04
Fred_Smith12-May-07 13:04 
AnswerRe: ASP.net C# whats up with this error? Pin
Colin Angus Mackay12-May-07 12:52
Colin Angus Mackay12-May-07 12:52 
AnswerRe: ASP.net C# whats up with this error? Pin
Christian Graus13-May-07 1:38
protectorChristian Graus13-May-07 1:38 
AnswerRe: ASP.net C# whats up with this error? Pin
ehtesham khan13-May-07 5:03
ehtesham khan13-May-07 5:03 
Questionget client information Pin
Mohammad Daba'an12-May-07 8:01
Mohammad Daba'an12-May-07 8:01 
AnswerRe: get client information Pin
Mazdak12-May-07 20:19
Mazdak12-May-07 20:19 
AnswerRe: get client information Pin
doWhileSomething13-May-07 7:36
doWhileSomething13-May-07 7:36 
Questioncrystal reports merge cells Pin
Mohammad Daba'an12-May-07 7:54
Mohammad Daba'an12-May-07 7:54 
Questiontreeview control Pin
jabbarsb12-May-07 4:45
jabbarsb12-May-07 4:45 
QuestionRow_Updating not updating old value with new value Pin
aransiola12-May-07 1:28
aransiola12-May-07 1:28 
QuestionRow_Databound Event Pin
aransiola12-May-07 1:25
aransiola12-May-07 1:25 
QuestionFor session problem (ASP.NET 2.0) Pin
Darshan_shah12-May-07 0:30
Darshan_shah12-May-07 0:30 
AnswerRe: For session problem (ASP.NET 2.0) Pin
kubben13-May-07 2:47
kubben13-May-07 2:47 
QuestionUrgent help pls pls for asp.net 2.0 Pin
Darshan_shah12-May-07 0:25
Darshan_shah12-May-07 0:25 
AnswerRe: Urgent help pls pls for asp.net 2.0 Pin
Sandeep Kumar13-May-07 20:12
Sandeep Kumar13-May-07 20:12 

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.