Doesn't anyone know how to access SQL Server data?

I am trying to use LINQ to get my data from a table

Page 1 of 1

5 Replies - 1275 Views - Last Post: 13 November 2009 - 04:41 PM Rate Topic: -----

#1 MauriceOsborn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 02-November 09

Doesn't anyone know how to access SQL Server data?

Posted 02 November 2009 - 02:31 PM

HELP! I need to be able to access data stored in an SQL server database. I have been able to store a new record of data in a Table that I created in a new database within the SQL server developer edition on my computer. I did this with a Submit button click event handler in C# with the sqldatasource control in an ASP.NET web page using Visual Studio. I can display the data on a web page in a grid format, but I need for my event handler software to access this data in order to know what to do next. Please help!

Is This A Good Question/Topic? 0
  • +

Replies To: Doesn't anyone know how to access SQL Server data?

#2 MauriceOsborn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 02-November 09

Re: Doesn't anyone know how to access SQL Server data?

Post icon  Posted 02 November 2009 - 02:40 PM

HELP! I need to be able to access data stored in an SQL server database. I have been able to store a new record of data in a Table that I created in a new database within the SQL server developer edition on my computer. I did this with a Submit button click event handler in C# with the sqldatasource control in an ASP.NET web page using Visual Studio. I can display the data on a web page in a grid format, but I need for my event handler software to access this data in order to know what to do next. Please help!
Was This Post Helpful? 0
  • +
  • -

#3 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Doesn't anyone know how to access SQL Server data?

Posted 02 November 2009 - 03:11 PM

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

#4 MauriceOsborn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 02-November 09

Re: Doesn't anyone know how to access SQL Server data?

Posted 04 November 2009 - 01:21 PM

View PostJayman, on 2 Nov, 2009 - 02:11 PM, said:

[rules][/rules]

To the Dream.In.Code folks,

I am delighted to be able to share my software with you in order to resolve the problem I am having in accessing data in a table of my database in SQL server development edition.

I used SQL Server Management Studio to define the columns in a table titled “dbo.Members” within my “FreedomDB” database. I have been able to create a row in the table and fill it with data that was entered in text boxes of a web page that I created.

I accomplished this with the use of the SqlDataSource control. However, I could not use this control to retrieve the stored data because it only works with data bound controls like the gridview control to display that data on a web page. It does not provide access of the data to the event handler software.

So, I have decided to use the LinqDataSource control, but this requires a data class model of the table’s data to be defined. I did that with the creation of a DataClasses1.dbml file.

Now, to test the ability to retrieve the new row of column data, I created a web page that enables the user to specify the primary key Callsign for a specific row of data and then have the Callsign and password column data from that row be displayed in labels on the page.

Unfortunately, when I dragged the LinqDataSource control onto the design screen, it displayed it along with a task block to Configure the Data Source. When I clicked that link, a “Choose a Context Object” window was displayed. But, when I clicked the down-arrow to select the context object, there was nothing there to choose and there was no way to specify a context object. So now I am stumped. What do I do now?

The following is the source code for the web page I created to test the retrieval of my data. The Submit button click event handler only defines a string named “Callsign” that contains the entries made by the user in the text box on the web page. Naturally, I am hoping to have this event handler software also display the table data in the specified row in labels. You will notice that there is nothing within the definition for the asp:LinqDataSource control. What should I do? Please help.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
	protected void Buttonsubmit_Click(object sender, EventArgs e)
		{
			string Callsign = Textbox1.Text;

		}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Server Data Output</title>
</head>
<body>
	<p style="text-align: center">
		Server Data Output</p>
	<form id="form1" runat="server">
	<div>
		<asp:TextBox ID="Textbox1" runat="server"></asp:TextBox>
&nbsp;Enter Callsign<br />
		<asp:Button ID="Button1" runat="server" onclick="Buttonsubmit_Click" Text="Submit" />
		<br />
		<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
&nbsp;Entered Callsign<br />
		<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
&nbsp;Entered Password<br />
		<br />
	</div>
	<asp:LinqDataSource ID="LinqDataSource1" runat="server">

	</asp:LinqDataSource>
	</form>
</body>
</html>




I am also attaching a file with screen saver images that show what I am talking about. Thanks.

Maurice

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

#5 MauriceOsborn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 02-November 09

Re: Doesn't anyone know how to access SQL Server data?

Post icon  Posted 13 November 2009 - 04:16 PM

To the Dream.In.Code folks,

I am delighted to be able to share my software with you in order to resolve the problem I am having in accessing data in a table of my database in SQL server development edition.

I used SQL Server Management Studio to define the columns in a table titled “dbo.Members” within my “FreedomDB” database. I have been able to create a row in the table and fill it with data that was entered in text boxes of a web page that I created.

I accomplished this with the use of the SqlDataSource control. However, I could not use this control to retrieve the stored data because it only works with data bound controls like the gridview control to display that data on a web page. It does not provide access of the data to the event handler software.

So, I have decided to use the LinqDataSource control, but this requires a data class model of the table’s data to be defined. I did that with the creation of a DataClasses1.dbml file.

Now, to test the ability to retrieve the new row of column data, I created a web page that enables the user to specify the primary key Callsign for a specific row of data and then have the Callsign and password column data from that row be displayed in labels on the page.

Unfortunately, when I dragged the LinqDataSource control onto the design screen, it displayed it along with a task block to Configure the Data Source. When I clicked that link, a “Choose a Context Object” window was displayed. But, when I clicked the down-arrow to select the context object, there was nothing there to choose and there was no way to specify a context object. So now I am stumped. What do I do now?

The following is the source code for the web page I created to test the retrieval of my data. The Submit button click event handler only defines a string named “Callsign” that contains the entries made by the user in the text box on the web page. Naturally, I am hoping to have this event handler software also display the table data in the specified row in labels. You will notice that there is nothing within the definition for the asp:LinqDataSource control. What should I do? Please help.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
	protected void Buttonsubmit_Click(object sender, EventArgs e)
		{
			string Callsign = Textbox1.Text;

		}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Server Data Output</title>
</head>
<body>
	<p style="text-align: center">
		Server Data Output</p>
	<form id="form1" runat="server">
	<div>
		<asp:TextBox ID="Textbox1" runat="server"></asp:TextBox>
&nbsp;Enter Callsign<br />
		<asp:Button ID="Button1" runat="server" onclick="Buttonsubmit_Click" Text="Submit" />
		<br />
		<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
&nbsp;Entered Callsign<br />
		<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
&nbsp;Entered Password<br />
		<br />
	</div>
	<asp:LinqDataSource ID="LinqDataSource1" runat="server">

	</asp:LinqDataSource>
	</form>
</body>
</html>




I am also attaching a file with screen saver images that show what I am talking about. Thanks.

Maurice

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

#6 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Doesn't anyone know how to access SQL Server data?

Posted 13 November 2009 - 04:41 PM

All 3 topics merged. DO not create any more threads regarding this issue :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1