|
YA I want to get value of this "ceiling(count(.//Category[Title=$subtitle]/Category/MetaData))" not this one as a string.
Please tell me any way to get this value in .cs plz.
|
|
|
|
|
Abubakarsb wrote: YA I want to get value of this "ceiling(count(.//Category[Title=$subtitle]/Category/MetaData))" not this one as a string.
As I said, I do not think it is possible, because it is a dynamic value that depends on the document currently getting transformed.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
i m using sqlserver with c#.net making a window application.
i have a table 'dealerlogin', from which i want to fetch the last row of the table which is inserted through a query.
I want to fetch the last row to get one of its field 'logindatetime' to use it in my update query in 'where' clause.
i want to know how can i fetch the last row of the table.
i.e -- Counting rows of 'dealerlogin' table one by one till last row is found and putting 'logindatetime' field's value in a variable.
But i dont know how to implement it.
Hope for some help.
Thank you.
Nekshan.
|
|
|
|
|
Hi,
Which are the fields of the table? You can try to fill a dataset with a query where you order the rows of the table desc... For example, using an autonumeric field(if you have one)... Or better than this, getting only the field using the same query and ExecuteScalar method...
|
|
|
|
|
select top 1 * from tablename order by column asc/desc
Obviously use either asc or desc
|
|
|
|
|
' convert it onto c# this code is i writen in vb
' this answer is the question u ask how to get value in dataset through function
' now u bind that as
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'write this code place at which u want data.
Dim ds As New DataSet
ds = RmaSearchByDays("0065xyz", 10)
' if u want to access ds data then write
For i = 0 To ds.Tables(0).Rows.Count
Dim str As String = ds.Tables(0).Rows(0).Item(0)
' str contain value item(0) means column 0, item(1) means column 1 ok.
Next i
End Sub
Public Function RmaSearchByDays(ByVal ACCOUNT_REF As String, ByVal TotalDays As Integer) As DataSet
Dim cn As SqlConnection = New SqlConnection("write here connection strings")
Dim cmd As SqlCommand = New SqlCommand()
cmd.CommandText = "write here select statement where account_ref='" + ACCOUNT_REF + "'" + "and tdays =" + TotalDays
cmd.Connection = cn
Dim da As SqlDataAdapter = New SqlDataAdapter()
Dim dsResult As New DataSet
da.SelectCommand = cmd
da.Fill(dsResult)
' Return the dataset result
Return dsResult
End Function
End Class
' this question answer is
select top 1 * from tablename order by column_name desc
'column name is column which is unique number columnname ok
' if u not able to understand then replay me.
|
|
|
|
|
Hello all,
I am new to .net, m developing a small application, the problem i face is whenever there is a postback on my page the font size of the whole page increases. How can i avoid this ??
Any help would be appreciable.
Thanks in advance.
Deepak
|
|
|
|
|
Hi
If font size increases after postback, it means there is some javascript error.
If it so, but how to check?? Then double click on the left corner of your web browser. (Instead of text 'Done', text 'Done with some errors' will be displayed if there is an error in your .aspx). Error may be syntax error or Braces not enclosed etc...
Check it now. Hope you got it.
- Harini
|
|
|
|
|
Hello All,
I have a web page with login control binded to custom sql membershipProvider to authorise the user. I was trying to use GetUser() method to display username but it is giving an error, I think i need to override
Membership.GetUser() method as well becos i understand its not using my custom SQL membership provider to get the loginname but iam stuck dont know how to acheive that. can someone help me out here, please see code below.
Login.aspx.cs
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
bool Authenticated = false;
Authenticated = SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password);
e.Authenticated = Authenticated;
if (Authenticated == true)
{
Response.Redirect(
"Welcome.aspx");
}
}
private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)
{
System.Data.SqlClient.
SqlConnection Con = new System.Data.SqlClient.SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
System.Data.SqlClient.
SqlCommand Cmd = new System.Data.SqlClient.SqlCommand();
Cmd.Connection = Con;
Cmd.CommandType =
CommandType.StoredProcedure;
try
{
Con.Open();
Cmd.CommandText =
"name";
Cmd.Parameters.Add(
"@UserName", SqlDbType.VarChar, 20);
Cmd.Parameters[
"@UserName"].Value = UserName;
Cmd.Parameters.Add(
"@Password", SqlDbType.VarChar, 20);
Cmd.Parameters[
"@Password"].Value = Password;
System.Data.SqlClient.
SqlDataReader reader = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
if (reader.HasRows)
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
//Return False;
}
throw new Exception("The method or operation is not implemented.");
}
Welcome.aspx.cs (After user logs in he is redirected to this page)
protected
void Page_Load(object sender, EventArgs e)
{
MembershipUser CurrentUser = Membership.GetUser(true); [This gives me an error ]
Label1.Text = CurrentUser.UserName.ToString();
}
Thanks in Advance for your help. Best Regards
|
|
|
|
|
Hi
How to get all the tables with their schema name in sql server 2005.
I am using adventures database. I know how to display all the tables in the database.
select * from information_schema.tables where table_type='base table'
I want to append the owner name (dbo.sales, sales.product )
can any one help me to solve my problem please?
kesavan
kesavan
|
|
|
|
|
select Table_Schema+'.'+Table_Name as fullname from information_schema.tables where table_type='base table'
|
|
|
|
|
I got a static page where I got 2 textbox for user logon so they can log on remotely from home and can access their work folders (home directory) and save document. what are the steps needed please help.
thanks
|
|
|
|
|
hi,
May i know what this error refers to..
Error 1 Only assignment, call, increment, decrement, and new object expressions can be used as a statement C:\Documents and Settings\user\Desktop\Naveed\WindowsApplication8\WindowsApplication8\Form1.cs 24 13 WindowsApplication8
Thank u
|
|
|
|
|
What is on the line the error refers to?
|
|
|
|
|
Hi All,
Kindly let me know the method, How to Maximize loaded program.
Example:
--------
Only Notepad is running on my system which is already minimized on the tray, and I want to maximize it using C# code.
Thank you
|
|
|
|
|
You need to p/invoke some windows api to achieve this. First you need to get the handle of the window that should be maximized and then use that hahndle to maximize it. Take a look at this these on pinvoke.net:
FindWindow (user32)[^]
ShowWindow (user32)[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Dear Mr. Stefan Troschtz
Thank you of your kind respons
|
|
|
|
|
My pleasure
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
I'm trying to use the Conditional Operator in C# in the form of
<bool condition> ? <true value> : <false value>;
and I want the value to return as NULL if the condition is false.
For example:
bool _validated = _boolText != null? bool.Parse(_boolText): null;
But an error occurs when trying to build.
Here is the error message:
Type of conditional expression cannot be determined because there is no implicit conversion between 'bool' and '<null>'
How can I solve this problem?
Thank you very much.
KiT
-- Never wait for a chance to come, Believe in your own potential and go get it! --
|
|
|
|
|
You must declare your boolean type variable to a nullable boolean, but this will only works in .NET 2005.
bool? _validated = _boolText != null ? bool.Parse(_boolText): null;
If you want to declare a nullable bool just add suffix "?" symbol to your datatype.
ex.
bool?
int?
string?
regards,
mark
-- modified at 1:51 Friday 23rd February, 2007
|
|
|
|
|
Hey that is cool.
Thanks Mark.
- Harini
|
|
|
|
|
|
Wow! Thanx a lot, Mark.
Never known there is this trick in C# 2.0.
By the way, is there any way to convert from non-nullable to nullable?
Say... I need to assign a value to a variable for web service.
In my provided example, the variable for a web service is of bool type.
How can i convert it to "bool?" ?
Thank you very much.
KiT
-- Never wait for a chance to come, Believe in your own potential and go get it! --
|
|
|
|
|
The non-nullable bool have two posible values either True or false only. I think It's imposible that your web services will return a null value if does this will generate an error object not set to instance. Back to your question. Yes, you can, just cast it.
bool? myvar = (bool?)MyWebServiceMethodBool();
Note: MyWebServiceMethodBool() will only return True or false because the data type of this method is non-nullable boolean the only posible value this method will return is either true or false.
the new myvar variable can have three value (true,false and null)
regards,
Mark
|
|
|
|
|
I see.
Thank you very much.
You're the man.
KiT
Never wait for a chance to come, Believe in your own potential and go get it!
|
|
|
|