|
hi everybody
am trying to understand interfaces .and i created a Console App with Two Classes( Somme and Tunnel) and an Interface called IAdd.
IAdd interface:
interface IAdd
{
int calc(int a,int b);
}
Somme Class that implement the IAdd interface:
class Somme : IAdd
{
public int calc(int a, int b)
{
return a + b;
}
}
Tunnel Class :
class Tunnel
{
IAdd som = new Somme();
som.calc(3,4);
}
but the MAin Console can use this writing.why i can't calculate the Somme and then send the result to the main Console.
Console Main:
static void Main(string[] args)
{
IAdd som = new Somme();
int x = som.calc(3, 4);
Console.WriteLine( x);
Console.ReadKey();
}
what's the point am missing here?
forget my english,am doing my best to learn many things .
|
|
|
|
|
i got it..i must do that in the constructor or in a method..
lke this
void Tunnel()
{
IAdd som = new Somme();
so
}
Silly Right ? Ooh Beginners...
|
|
|
|
|
how to write into text box from database query row values?
|
|
|
|
|
You can try this code:
SqlConnection conn = new SqlConnection(connectionStringArg);
SqlCommand command = new SqlCommand("select field from table");
command.Connection = conn;
conn.Open();
textbox.text = (string)command.ExecuteScalar();
conn.Close();
If you need more than the first column from the first row returned, you'll need to use ExecuteReader().
|
|
|
|
|
|
You do this by
1) Setting up a connection to the database using a connection string.
2) Using ADO.Net to write a parameterized query and then execute this query to fetch this data.
3) Displaying this in the text box.
|
|
|
|
|
I'm using google api 2.0 for .net. I use this code to create a new calendar:
CalendarEntry calendar = new CalendarEntry();
calendar.Title.Text = "Little League Schedule";
calendar.Summary.Text = "This calendar contains the practice schedule and game times.";
calendar.TimeZone = "America/Los_Angeles";
calendar.Hidden = false;
calendar.Color = "#2952A3";
calendar.Location = new Where("", "", "Oakland");
Uri postUri = new Uri("https://www.google.com/calendar/feeds/default/owncalendars/full");
CalendarEntry createdCalendar = (CalendarEntry) service.Insert(postUri, calendar);
but, on execution, return the error:
Execution of request failed
at the line
CalendarEntry createdCalendar = (CalendarEntry) service.Insert(postUri, calendar);
However, if I connect to google calendar with the browser, the new calendar is created.
Also, I use this code to retriving all calendars and it's works
CalendarQuery query = new CalendarQuery();
query.Uri = new Uri("https://www.google.com/calendar/feeds/default/allcalendars/full");
CalendarFeed resultFeed = (CalendarFeed) service.Query(query);
Any suggestions?? Thanks
|
|
|
|
|
Looks almost identical to the example from the manual. Did you call the authenticate-method of the service object?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
yes, the code is identical. I'm writing a test application.
For authentication I used this code:
CalendarService service = new CalendarService(companyName + "-" + applicationName + "-" + versionID);
service.setUserCredentials(_uid, _psw);
|
|
|
|
|
Multiple versions of the same libraries, some deprecated, some not. Poor documentation..
First tried your version of the sample, and it failed to work. Apparently the version of the assemblies do not match the ones described in the docs.
Download the SDK here; http://code.google.com/p/google-gdata/[^]
Next, download ILSpy, and open the binary called "Calender.exe" located under
C:\Program Files (x86)\Google\Google Data API SDK\Samples\
Open the SampleApp namespace and select the Calender-class. You'll get a decompiled version on the right-side of your screen. Expand each method to see it's body, copy & paste it to a test-project, and run
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I found the problem ... I set the property value calendar.TimeZone = "Italy / Rome" but the correct value is "Europe / Rome".
thanks!
|
|
|
|
|
Cool - you're welcome
|
|
|
|
|
How can i Import Data of a Dataview in wpf to MsWord
|
|
|
|
|
|
|
List lstusers = new List();
lstusers = AMSManagement.GetAllUsers();
var lnquser = from u in lstusers
show error here plz help me!!!
-------------
where u.User_ID == int.Parse(Session["UserID"].ToString()) && u.Pass_word == txtopwd.Text.Trim()
select u;
--------------------
if (lnquser.ToList().Count > 0)
{
users u = new users();
u.User_ID = int.Parse(Session["UserID"].ToString());
u.Pass_word = txtcnpwd.Text.Trim();
AMSManagement.Changepassword(u);
lblmsg.Text = "Password Changed Successfully!";
}
|
|
|
|
|
Are you very sure the session contains UserID?
Try with the following code:
where u.User_ID == int.Parse(Session["UserID"]==null? "0":Session["UserID"].ToString()) && u.Pass_word == txtopwd.Text.Trim()
|
|
|
|
|
List<users> lstusers = new List<users>();
lstusers = AMSManagement.GetAllUsers();
var lnquser = from u in lstusers
where u.User_ID == int.Parse(Session["UserID"] == null ? "0" : Session["UserID"].ToString())&& u.Pass_word==txtopwd.Text.Trim()
select u;
if (lnquser.ToList().Count > 0)
{
users u = new users();
u.User_ID = int.Parse(Session["UserID"].ToString());
u.Pass_word = txtcnpwd.Text.Trim();
AMSManagement.Changepassword(u);
lblmsg.Text = "Password Changed Successfully!";
}
else
{
lblmsg.Text = "plz enter valid old password!";
}
when i change code as your view then it execute else part
|
|
|
|
|
Could you please debug and check the value of Session["UserID"]
I think Session["UserID"] is not initiated.
|
|
|
|
|
|
Could you please post the code where are you setting the value of Session["UserID"]?
|
|
|
|
|
public int User_ID { set; get; }
public string UserID { set; get; }
public string Pass_word { set; get; }
public string UserType { set; get; }
|
|
|
|
|
you need to check the value of the UserID
string UserID = Session["UserID"].ToString();
I would put this before the LinQ statement and put a breakpoint on it, step over that line and then see what if any value UserID holds. So change your code to
string UserID = Session["UserID"].ToString();
var Inquser = from u in lstusers where u.User_ID == int.Parse(Session["UserID"].ToString()) && u.Pass_word == txtopwd.Text.Trim();
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Try this instead:
int userId;
object sessionValue = Session["UserID"];
string session = string.Empty;
string password = txtopwd.Text;
if (session != null && int.TryParse(session.ToString(), out userId) && !string.IsNullOrWhitespace(password))
{
var lnguser = from u in lstusers where u.User_ID == userId && u.Pass_word == password.Trim();
}
|
|
|
|
|