|
|
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[^]
|
|
|
|
|
Thank you Jasmine2501
|
|
|
|
|
"screen size" is not OK: do you expect all your users to run their web browsers maximized? I don't - and I get annoyed by some stupidly designed web pages assuming that they can use 2560 pixels wide (or sometimes even 4480 pixels, since I have two monitors). The client size of the browser is the correct value!
|
|
|
|
|
I am not looking for any browser pixels i was looking for a page which does not show much of a whitespace.......please read the post properly....
|
|
|
|
|
If you adjust for browser or, screen size, you will still need to think about printer friendly version of your web pages.
|
|
|
|
|
hi everyone,
i'm having a problem like i have gridview control with
4 columns and column1 is a text column and col2 is flag column where as col3 and col4 are item templates where a textbox is embedded in each of the item templates, col1 text and col2 values
are comming from oracle ref cursor, based on the flag condition of col2 coming from ref cursor we need to display the item template with textboxes in col3 & col4 and how to validate those boxes in item template when submitting data to the database meanwhile we need to convert the data into an xml format to store the data to the database ,if anyone who understand my problem are invited to answer.
thanks in advance,
jeeva
|
|
|
|
|
I have some data from model , in which i getting some hex values .. now i need to translate this hex values to real color.
I have try this way...
@Html.DisplayFor(modelItem=>System.Drawing.ColorTranslator.FromHtml(item.color))
But this not working.
item.Color is a value from database and it's like this #ffffff;
Any suggestions ?
Thanks for help in advance!
|
|
|
|
|
try this
<span style="display: inline-block; width: 20px; height: 20px; background-color: @item.Color"></span>
it would display like this:
Help people,so poeple can help you.
modified 29-May-13 1:54am.
|
|
|
|
|
Ali you are the King!
Thank you!
|
|
|
|
|
The king of Persia
Help people,so poeple can help you.
|
|
|
|
|
In GridView
BackColor='<# System.Drawing.Color.FromName(Eval("item_color").ToString())%>'
|
|
|
|
|
Thnxs for info how to do that in WebGrid!
|
|
|
|
|
Alem.B wrote: But this not working.
Define "not working".
The only obvious problem with your code is the inconsistent naming in your lambda expression:
modelItem => System.Drawing.ColorTranslator.FromHtml(item.color)
This should either be item => ... or ...FromHtml(modelItem.color) .
Also, is it item.color or item.Color ? In C#, the case matters.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thnxs for some sahring some intresting info!
|
|
|
|
|
Thnxs for some sharing some intresting info!
|
|
|
|
|
How to use i frame in asp.net with dynamic height
|
|
|
|
|
set runat="server" id="ifWidth" in iframe tags.
and then write the coding in server side in bellow format
ifWidth.Attribute.add("style","height:350;");
|
|
|
|
|
Hi everyone! I have a page in an e-shop where i would like someone to be able to view his orders. So i want to display data from an orders table in DB using a stored procedure and checking the userid session, so that the user who is logged in can see his orders. Here is my code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="order_id" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="order_id" HeaderText="order_id"
InsertVisible="False" ReadOnly="True" SortExpression="order_id" />
<asp:BoundField DataField="order_date" HeaderText="order_date"
SortExpression="order_date" />
<asp:BoundField DataField="order_value" HeaderText="order_value"
SortExpression="order_value" />
<asp:BoundField DataField="order_status" HeaderText="order_status"
SortExpression="order_status" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:BoardGamesConnectionString %>"
SelectCommand="'OrderInfo'" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter Name="order_id" Type="Int32" />
<asp:Parameter Name="order_value" Type="String" />
<asp:Parameter Name="order_date" Type="String" />
<asp:Parameter Name="order_status" Type="String" />
<asp:SessionParameter Name="UserID" SessionField="UserID"
Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
Stored Procedure looks like this:
ALTER PROCEDURE [dbo].[Orderinfo]
@order_id int,
@order_value nvarchar(max),
@order_date nvarchar(max),
@order_status nvarchar(max),
@UserID int
AS
Select order_id, order_date, order_value, order_status from Orders Where UserID=@UserID And order_status='Εκκρεμεί'
What am i doing wrong? Thanks in advance!
|
|
|
|
|
Hi Diana,
I hope you are expecting to bind the orders for the particular user based on the Session["UserID"].
Then why you are passing the @order_id, @order_value, @order_date, @order_status to your Orderinfo (Stored Procedure). Okay let it be.
If you think it is necessary to pass those parameter (@order_id, @order_value, @order_date, @order_status) then you have to pass corresponding values for those parameter.
To pass the values for the corresponding parameters you have to create OnSelecting event for the SqlDataSource as below
Quote: <asp:gridview id="GridView1" runat="server" autogeneratecolumns="False"
="" datakeynames="order_id" datasourceid="SqlDataSource1">
<columns>
<asp:boundfield datafield="order_id" headertext="order_id"
="" insertvisible="False" readonly="True" sortexpression="order_id">
<asp:boundfield datafield="order_date" headertext="order_date"
="" sortexpression="order_date">
<asp:boundfield datafield="order_value" headertext="order_value"
="" sortexpression="order_value">
<asp:boundfield datafield="order_status" headertext="order_status"
="" sortexpression="order_status">
<asp:sqldatasource id="SqlDataSource1" runat="server"
="" connectionstring="<%$ ConnectionStrings:BoardGamesConnectionString %>" <b="">SelectCommand="OrderInfo" SelectCommandType="StoredProcedure" OnSelecting="SqlDataSource1_Selecting">
<SelectParameters>
<asp:parameter name="order_id" type="Int32">
<asp:parameter name="order_value" type="String">
<asp:parameter name="order_date" type="String">
<asp:parameter name="order_status" type="String">
<asp:sessionparameter name="UserID" sessionfield="UserID"
="" type="Int32">
</SelectParameters>
Then in the code behind add the below SqlDataSource1_Selecting event
protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
e.Command.Parameters["@order_id"].Value = 0;
e.Command.Parameters["@order_value"].Value = "";
e.Command.Parameters["@order_date"].Value = "";
e.Command.Parameters["@order_status"].Value = "";
}
I hope this one will help you.
Please give your valuable feedback, It will help me in future. ( This my first post).
S. Prince Sagayaraj
|
|
|
|