|
Hi All,
1.I need to join two database in a sp
2.I need to do all crud operation using that sp in c# asp.net
|
|
|
|
|
I am running a program which downloads data from yahoo finance. The program has 2 parts. Under Default.aspx I have the following code :
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="sample._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Stock quote and chart from Yahoo in C#</title>
<script type="text/javascript" language="JavaScript">
/// <summary>
/// This function will be called when user clicks the Get Quotes button.
/// </summary>
/// <returns>Always return false.</returns>
function SendRequest()
{
var txtSymbol = document.getElementById("txtSymbol");
// Refresh the page.
window.location = "default.aspx?s=" + txtSymbol.value;
return false;
}
/// <summary>
/// The functyion will be called when a keyboard key is pressed in the textbox.
/// </summary>
/// <param name="e">Onkeypress event.</param>
/// <returns>Return true if user presses Enter key; otherwise false.</returns>
function CheckEnter(e)
{
if ((e.keyCode && e.keyCode == 13) || (e.which && e.which == 13))
// Enter is pressed in the textbox.
return SendRequest();
return true;
}
/// <summary>
/// The function will be called when user
// changes the chart type to another type.
/// </summary>
/// <param name="type">Chart type.</param>
/// <param name="num">Stock number.</param>
/// <param name="symbol">Stock symobl.</param>
function changeChart(type, num, symbol)
{
// All the DIVs are inside the main DIV
// and defined in the code-behind class.
var div1d=document.getElementById("div1d_"+num);
var div5d = document.getElementById("div5d_" + num);
var div3m = document.getElementById("div3m_" + num);
var div6m = document.getElementById("div6m_" + num);
var div1y = document.getElementById("div1y_" + num);
var div2y = document.getElementById("div2y_" + num);
var div5y = document.getElementById("div5y_" + num);
var divMax = document.getElementById("divMax_" + num);
var divChart = document.getElementById("imgChart_" + num);
// Set innerHTML property.
div1d.innerHTML = "1d";
div5d.innerHTML="5d";
div3m.innerHTML="3m";
div6m.innerHTML="6m";
div1y.innerHTML="1y";
div2y.innerHTML="2y";
div5y.innerHTML="5y";
divMax.innerHTML="Max";
// Use a random number to defeat cache.
var rand_no = Math.random();
rand_no = rand_no * 100000000;
// Display the stock chart.
switch(type)
{
case 1: // 5 days
div5d.innerHTML="5d";
divChart.src = "http://ichart.finance.yahoo.com/w?s=" +
symbol + "&" + rand_no;
break;
case 2: // 3 months
div3m.innerHTML="3m";
divChart.src = "http://chart.finance.yahoo.com/c/3m/" +
symbol + "?" + rand_no;
break;
case 3: // 6 months
div6m.innerHTML = "6m";
divChart.src = "http://chart.finance.yahoo.com/c/6m/" +
symbol + "?" + rand_no;
break;
case 4: // 1 year
div1y.innerHTML = "1y";
divChart.src = "http://chart.finance.yahoo.com/c/1y/" +
symbol + "?" + rand_no;
break;
case 5: // 2 years
div2y.innerHTML = "2y";
divChart.src = "http://chart.finance.yahoo.com/c/2y/" +
symbol + "?" + rand_no;
break;
case 6: // 5 years
div5y.innerHTML = "5y";
divChart.src = "http://chart.finance.yahoo.com/c/5y/" +
symbol + "?" + rand_no;
break;
case 7: // Max
divMax.innerHTML = "msx";
divChart.src = "http://chart.finance.yahoo.com/c/my/" +
symbol + "?" + rand_no;
break;
case 0: // 1 day
default:
div1d.innerHTML = "1d";
divChart.src = "http://ichart.finance.yahoo.com/b?s=" +
symbol + "&" + rand_no;
break;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table width="100%" border="0"
cellspacing="0" cellpadding="0">
<tr valign="top">
<td style="font-family: Arial, Helvetica, sans-serif;
font-size: 14px; color: #000; text-decoration: none;">
<input type="text" value="" id="txtSymbol"
runat="server" onkeypress="return CheckEnter(event);" />
<input type="button" value="Get Quotes"
onclick="return SendRequest();" />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;
font-size: 11px; color: #666;">
e.g. "YHOO or YHOO GOOG"
</span>
<%if (m_symbol != "") {%>
<div id="divService" runat="server">
<!-- Main DIV: this DIV contains text and DIVs
that displays stock quotes and chart. -->
</div>
<%}%>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
And under Default.aspx page I have the following code:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="sample._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Stock quote and chart from Yahoo in C#</title>
<script type="text/javascript" language="JavaScript">
/// <summary>
/// This function will be called when user clicks the Get Quotes button.
/// </summary>
/// <returns>Always return false.</returns>
function SendRequest()
{
var txtSymbol = document.getElementById("txtSymbol");
// Refresh the page.
window.location = "default.aspx?s=" + txtSymbol.value;
return false;
}
/// <summary>
/// The functyion will be called when a keyboard key is pressed in the textbox.
/// </summary>
/// <param name="e">Onkeypress event.</param>
/// <returns>Return true if user presses Enter key; otherwise false.</returns>
function CheckEnter(e)
{
if ((e.keyCode && e.keyCode == 13) || (e.which && e.which == 13))
// Enter is pressed in the textbox.
return SendRequest();
return true;
}
/// <summary>
/// The function will be called when user
// changes the chart type to another type.
/// </summary>
/// <param name="type">Chart type.</param>
/// <param name="num">Stock number.</param>
/// <param name="symbol">Stock symobl.</param>
function changeChart(type, num, symbol)
{
// All the DIVs are inside the main DIV
// and defined in the code-behind class.
var div1d=document.getElementById("div1d_"+num);
var div5d = document.getElementById("div5d_" + num);
var div3m = document.getElementById("div3m_" + num);
var div6m = document.getElementById("div6m_" + num);
var div1y = document.getElementById("div1y_" + num);
var div2y = document.getElementById("div2y_" + num);
var div5y = document.getElementById("div5y_" + num);
var divMax = document.getElementById("divMax_" + num);
var divChart = document.getElementById("imgChart_" + num);
// Set innerHTML property.
div1d.innerHTML = "1d";
div5d.innerHTML="5d";
div3m.innerHTML="3m";
div6m.innerHTML="6m";
div1y.innerHTML="1y";
div2y.innerHTML="2y";
div5y.innerHTML="5y";
divMax.innerHTML="Max";
// Use a random number to defeat cache.
var rand_no = Math.random();
rand_no = rand_no * 100000000;
// Display the stock chart.
switch(type)
{
case 1: // 5 days
div5d.innerHTML="5d";
divChart.src = "http://ichart.finance.yahoo.com/w?s=" +
symbol + "&" + rand_no;
break;
case 2: // 3 months
div3m.innerHTML="3m";
divChart.src = "http://chart.finance.yahoo.com/c/3m/" +
symbol + "?" + rand_no;
break;
case 3: // 6 months
div6m.innerHTML = "6m";
divChart.src = "http://chart.finance.yahoo.com/c/6m/" +
symbol + "?" + rand_no;
break;
case 4: // 1 year
div1y.innerHTML = "1y";
divChart.src = "http://chart.finance.yahoo.com/c/1y/" +
symbol + "?" + rand_no;
break;
case 5: // 2 years
div2y.innerHTML = "2y";
divChart.src = "http://chart.finance.yahoo.com/c/2y/" +
symbol + "?" + rand_no;
break;
case 6: // 5 years
div5y.innerHTML = "5y";
divChart.src = "http://chart.finance.yahoo.com/c/5y/" +
symbol + "?" + rand_no;
break;
case 7: // Max
divMax.innerHTML = "msx";
divChart.src = "http://chart.finance.yahoo.com/c/my/" +
symbol + "?" + rand_no;
break;
case 0: // 1 day
default:
div1d.innerHTML = "1d";
divChart.src = "http://ichart.finance.yahoo.com/b?s=" +
symbol + "&" + rand_no;
break;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table width="100%" border="0"
cellspacing="0" cellpadding="0">
<tr valign="top">
<td style="font-family: Arial, Helvetica, sans-serif;
font-size: 14px; color: #000; text-decoration: none;">
<input type="text" value="" id="txtSymbol"
runat="server" onkeypress="return CheckEnter(event);" />
<input type="button" value="Get Quotes"
onclick="return SendRequest();" />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;
font-size: 11px; color: #666;">
e.g. "YHOO or YHOO GOOG"
</span>
<%if (m_symbol != "") {%>
<div id="divService" runat="server">
<!-- Main DIV: this DIV contains text and DIVs
that displays stock quotes and chart. -->
</div>
<%}%>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
When I run the program , I get the bundles elements is not declared and txtSymbol and divService does not exist in the current context.
|
|
|
|
|
Hi
I would like to add live Tv Chanel in asp.net web application can anyone suggest me how can i approach to do so... plz...
i searched in Google but no luck. i got only saved video files streaming but i am searching for LIVE STREAMING...
|
|
|
|
|
hey.. firstly you ned some sort of streaming software. such as Broadcam,Windows Movie maker,
that will allow you to stream video and moreover, static IP is also needed for the purpose.
Chetan
facebook.com/thechetantalwar
|
|
|
|
|
Thank You Chethan..
|
|
|
|
|
Hi,
What is the logic/meaning behind every character used in this validationExpression like \b \w [..] (-a) etc.
Please explain.
Thanks in advance.
|
|
|
|
|
|
|
I am running into a problem here, and I have no code needed or that requires debugging. I am looking for more of an idea to solve this issue, so here it is.
I have a *.exe that is a command prompt utility that generates images. What I am doing is using this utility for my asp.net website. In the background I do processing for each date in a asp.net calendar. If the image doesn't exist in the images directory for that date, Calendar_DayRender calls the backend to use the exe via Process. The image creation works great. As does the loading, if the image was already created in a previous session by any other user.
The problem is that the images are being created too quicky and I cannot load the image because when I try to add the Image to the cell, it was not created quickly enough. Any ideas on how I can solve this timing issue?
|
|
|
|
|
Check for the existence of the image file in the main thread before you send the reply to the client.
|
|
|
|
|
Make the image request synchronous? How are you requesting the image in the first place? If you do it with a tag, the browser should wait for a response.
I've done this in the past...
If the myImageGenerator.aspx page streams back an image, the browser will display it. I learned this technique from an OLD article on here about Captcha - the image streaming technique is still valid.
A CAPTCHA Server Control for ASP.NET[^]
|
|
|
|
|
I have been creating a smaller scale MUCH SIMPLIFIED version of a registration system that assumes classes are taught once a week. This system already checks if a teacher has taught 3 classes to not select him for further classes. But I need to make sure it also checks that the room is not already chosen for a class previous during the time it wants.
What I have so far selects rooms and shows them in a drop down list, but I am able to make it show all room less everything chosen so far but it does not take into consideration the time and day of the week and so it is eliminating anything chosen, not just for the day of the week and the start_Hour and end_Hour times.
string commandText1 = "SELECT * FROM tblRoom WHERE NOT EXISTS (SELECT * FROM tblClass WHERE tblRoom.room_Num = tblClass.room_Num)";
var ds1 = new DataSet();
using (var connection = new OleDbConnection(connectionString))
using (var command = new OleDbCommand(commandText1, connection))
{
command.Parameters.AddWithValue("@p0", ddlRoom.SelectedValue);
var adapter = new OleDbDataAdapter(command);
adapter.Fill(ds1);
}
ddlRoom.DataSource = ds1;
ddlRoom.DataTextField = "room_Num";
ddlRoom.DataValueField = "room_Num";
ddlRoom.DataBind();
ddlRoom.Items.Insert(0, new ListItem("Please Select", "0"));
ddlRoom.Items.Insert(1, new ListItem("TBD", "TBD"));
}
}
tblRoom consists of tblRoom.room_Num (Key) TextString with Room#
tblClass consists of tblClass.room_Num (FK) TextString,
CourseID (FK) from tblCourse, week_Day which is the Day Of the Week (Monday, Tueday, Wednesday, Thursday, Friday or Saturday). start_Hour and end_Hour for when the class begins and ends.
What I am looking for is to improve the select command above so it can use week_Day = ? (ddlweekDay.SelectedValue) start_Hour (ddlstarthour.selectedvalue), end_Hour (ddlendHour.SelectedValue) OR to "remove" it from the drop down after it populates but before it shows the user. Hence perhaps a subroutine it can run called checkavailablity() where it might pass these parameters when all the time fields have been filled out or something. I know I can remove a line from the drop down and do it by naming the courseID or something? This is at least my next approach idea.
This is a very simplified version and has simple assumptions, not need to over think this. There is no gym class, and each class room is just that a class room. I just want to be able to schedule the classes -- not adding students as yet.
|
|
|
|
|
Seems difficult to give you a precise answer without knowing more about the database.
From my point of view, but I might be biased as I come more from a SQL background than many, I would create a SQL View, taking parameters (stored procedure) returning all ClassRooms available between 2 datetime (start and end), and I would do my select against this view.
Also, as I guess classes starts and end at a fixed hour, instead of using a whole datetime twice, I would build a fixed table with ID values, for example, from 8 to 8:45 AM = #1, from 9 to 9:45 = #2, and so on...
Just some ideas....
|
|
|
|
|
I am brainstorming ideas for an web browser WYSIWYG text editor for LED like displays. The editor will show a matrix of bulbs. As the user types, the bulbs corresponding to the keys pressed will be turned on. The editor will support backspace and most basic text editor functions. The displays are also of different sizes (pixel height, width, etc) and support different fonts.
I've seen where javascript supports key up/down events. What I am focusing on right now is the edittable pixel display.
The two ideas I have right now are
1) A table with each cell filled with an OffBulb.png. As the user types, javascript determines the appropriate cells to be changed to an OnBulb.png.
2) The server creates .png for all supported characters (~200 chars - a lot of images) and as the user types, the character pngs are layed out in the container one after the other.
Does anyone have any ideas?
The platform will be .NET either MVC or possible WebForms.
|
|
|
|
|
You mean a look-up table right? You put your 200 characters in an array of objects which each hold the name of the character and the image for the character. THAT array NEVER changes!
When the user enters the characters they want, you create an array for the user input, but don't copy the values from the 200-character array - copy the indexes. So, in memory, the message looks like this...
53 41 4c 45 20 6f 6e 20 44 56 44 73 20 54 4f 44 41 59 21 - which I would bet is exactly what the sign stores too.
So "the character pngs are layed out in the container one after the other." isn't the right way to do it - just put the reference numbers in there. Making copies of the character set is wasteful, and LED signs don't have a ton of memory - you should emulate that behavior in your web interface.
And when you're done... please fix Bubba Chino's sign... it has been flashing "LED SIGN!" for two years ever since he bought it
|
|
|
|
|
Hi Everyone,
What is the difference between DBContext class and ObjectContext ?
|
|
|
|
|
|
hello Friends
i made a asp.net page that accepted rss address. now,I want to read the content of any links that exist in rss for this action i writed follow code:
protected void Button_Rssreader_Click(object sender, EventArgs e)
{
var reader = XmlReader.Create(TextBox1.Text);
var feed = SyndicationFeed.Load(reader);
reader.Close();
string s = "";
foreach (SyndicationItem i in feed.Items)
{
s += i.Title.Text + "<br />" + i.Summary.Text + "<br/>" + i.PublishDate.ToString() + "<br />" + "<br />" + (i.Content as TextSyndicationContent).Text.Trim();
s += "<hr />";
}
Literal1.Text = s;
}
But i can just see the summary of RSS link if Delete (i.Content as TextSyndicationContent).Text.Trim()
i want to see the links of picture beside summary in the Rss link
Point : id don't want to see the link of picture that is in the XML links. really i need to read & download the Rss Links of picture to Display them beside the news (text ).
|
|
|
|
|
|
I am trying to say if a teacher is already teaching 3 classes flag it by returning a true if so, or a false if not. I have it counting the rows (or so I thought), but it is saying the way I did it is not correct. That Tables[0] is invalid.
private bool ValidateTeacher(string TeacherID, String Semester)
{
string path = Server.MapPath("eAcademy_DB.mdb");
string connectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" + path;
string commandText = "SELECT COUNT(*) FROM tblClass WHERE emp_ID=? and sem_Time=?";
var ds6 = new DataSet();
using (var connection = new OleDbConnection(connectionString))
using (var command = new OleDbCommand(commandText, connection))
{
var adapter = new OleDbDataAdapter(command);
if (ds6.Tables[0].Rows.Count > 3)
{
return false;
}
else return true;
}
}
|
|
|
|
|
You have to fill the DataSet before you read from it.
adapter.Fill(ds6, "Teacher");
|
|
|
|
|
You are just creating an adapter and a dataset. You have fill the dataset using the adapter.
adapter.Fill(ds6);
or
adapter.Fill(ds6, "<Your table name>");
|
|
|
|
|
I have just started to learn C# and Asp.Net and I have a specific project in mind but I need to be able to manipulate cookies client side and I can't find good documentation for this so I decided to ask for help to get a starting point.
I want to make a desktop application that is a little to complex for my actual knowledge but I need a starting point: I need to be able to load a list of usernames and passwords and proxies and proxyuser and proxy pass. This little part of the application will use the accounts and proxies to login to a webpage using httpclient. When I send a GET request to the login page I get back a response that contain some hidden parameters that I must assign to some variables and a cookie. I don't know how to save that cookie in a location that I choose (the application folder under the "cookies" folder) with the name that I choose (the username used for login should be the name of that cookie). After I sort thru the response I have to send a POST request to the server with all the hidden parameters and the user and pass parameters and the cookie. The server will send back a response with another cookie that I want to save in the same location as the first one with the same name (overwritten ). This cookie will be used later in the program to do other actions on that server under that login. All this requests must use a certain proxy with its credentials, proxy that will change every time I use a new login.
I managed to find out how to use the HTTP Client from Asp.Net Web API to send the get req or to post but I have no idea how to get such a control over cookies that the site want to store on my computer and how to use different private proxies for each login... I did all the above using PHP and CURL and is very easy to control the cookies using cURL but I need to do it in C# and make a desktop app so ... Asp.Net Web API and HTTP Client is the key I think...
Please give me a hand to start my project and don't dismiss my question just because I'm to noob with .net or c#
Thank You!
Florin Curelaru
|
|
|
|
|
i Would like to know the code for resizing the webpage according to the screen size or the screen resolution please help me.it can either be using css, javascript or html
|
|
|
|
|
This is called "Responsive Design" meaning the web page responds to different device sizes...
Now that you know what it is called, you should be able to research the subject yourself. It is complicated, and you're going to have to make the decisions yourself about how to approach it for your situation...
https://www.google.com/?q=responsive%20web%20design[^]
|
|
|
|