|
The Session is only valid for 24 hours.
I are Troll
|
|
|
|
|
Apparently not if you set the expiry time to 0. Anyway, I don't think this is the best way to try and implement single sign-on. I'm just giving it a shot since I'm kind of at a dead end. I've got all the users' usernames and passwords, I just need to find a way to log them in automatically
|
|
|
|
|
Etienne_123 wrote: Apparently not if you set the expiry time to 0.
Don't know where you got this information, but the docs[^] state something else;
Users don't log out of desktop applications. A user's session expires after 24 hours,
or when the user closes your application. If you need to, you can terminate a user's
session by calling auth.expireSession.
I are Troll
|
|
|
|
|
Exactly - OR when the user closes the application. My application is meant to be run 24/7.
|
|
|
|
|
Is that a AND/OR or XOR ? Sessions are usually temporary, and according to the docs I just been reading, you'd want to request "offline access". See the bottom of this[^] page.
I are Troll
|
|
|
|
|
Please Friends Help me
i have 4 tables
1. Master Book Table (MBookId,BookId,AuthorId,PubId)
2. Book Name ( BookId,BookName)
3. Author Name (AuthorId,AuthorName)
4. Publisher Name (PubId, PubName)
DAL
UI Layer
DAL ----
Please suggest me how to achieve Datarelationship
DataRelation dr = new DataRelation("BookBookName",
ds.Tables["MBook"].Columns["BookId"],
ds.Tables["Book"].Columns["BookId"]);
ds.Relations.Add(dr);
is this right ?
and how to use this in UI to get data, insert,update, save.. etc
i google a lot but didn't find the right solution for my purpose
and is datarelation ship with dataset is better or NHIBERNATE
if nhiberate is better then do ineed to start in from start i mean i have to create the tables and all that once..........
i have already created the datatable and DAL methods of Save Edit etc....
Please Help
Thank you very much EveryOne..... (specially CODEPROJECT)
|
|
|
|
|
You need to do following.
DataRelation dr = new DataRelation("BookBookName",
ds.Tables["MBook"].Columns["BookId"],
ds.Tables["Book"].Columns["BookId"]);
DataRelation dr1 = new DataRelation("BookAuthorName",
ds.Tables["MBook"].Columns["AuthorId"],
ds.Tables["AName"].Columns["AuthorId"]);
and so on.
So you have finally four datarelation object.
Then add all relation object to dataset, like..
ds.Relations.Add(dr);
ds.Relations.Add(dr1);
ds.Relations.Add(dr2);
You can do navigation as follows
foreach (DataRow MBookRow in customerOrders.Tables["NBook"].Rows)
{
Console.WriteLine(MBookRow["MBookId"].ToString());
foreach (DataRow BNameRow in MBookRow.GetChildRows(dr1))
{
Console.WriteLine(BNameRow["BookId"].ToString() + " " + BNameRow["BookName"].ToString());
}
}
Refer this[^] link for DataSet Vs NHibernate.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Is there such good examples or explaination for this issue?
right now, I've got this....
Project A
* calling SeekHidDevices in Project B
* ReadPort method
Project B
* SeekHidDevices method & calling ReadPort method in Project A
* returns SeekHidDevices value back to Project A
I've got 2 devices but only got 1 (crashes when doing the 2nd devices in SeekHidDevices method during ReadPort calling.
|
|
|
|
|
This should not be a problem if the code is written correctly. The only time it would cause a problem is if methodA (in A) calls methodB (in B), which in turn calls methodA thus creating a closed loop. Having said that you may wish to review the design of your application.
It's time for a new signature.
|
|
|
|
|
Perhaps a better explaination of using "Interface"?
|
|
|
|
|
Blubbo wrote: Perhaps a better explaination of using "Interface"?
???
It's time for a new signature.
|
|
|
|
|
Blubbo wrote: I've got 2 devices but only got 1 (crashes when doing the 2nd devices in SeekHidDevices method during ReadPort calling.
I don't understand this bit at all...
But - how can you have created a reference to project a in project b as well as a reference to project b in project a? That's circular and shouldn't allow you to add the reference in the first place (in VS it gives you an error when you try to add the reference)
What you need to do is have project C which contains 'utility' functions - A and B both reference C - C can contain utility methods, classes, anything that needs to be more generally accessed.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Okay. I get the a bit of the idea what you're saying. Any example on this?
|
|
|
|
|
Hi,
I have a problem when i try to use stored procedure in C#.net. Well when i run the stored procedure in sql server , it works fine and when the same query if i run in C#.net without using stored procedure, it works fine too. But when i try to use stored procedure in c#.net, it gave errors. The error is like this:
System.Data.SqlClient.SqlException: The EXECUTE permission was denied on the object 'SelectItem', database 'Student', schema 'dbo'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) at Default_View.DisplayItem() in C:\Documents and Settings\smanandhar\My Documents\Visual Studio 2008\Projects\StudentPortlet\Default_View.ascx.cs:line 285
the stored procedure is :
ALTER PROCEDURE [dbo].[SelectItem]
@UserID nvarchar (50)
AS
BEGIN TRANSACTION
select i.Item,i.ItemDescription,i.Category,i.Amount,i.SubmissionDate,i.ProposalID from ProposalItem i,Proposal j where
i.ProposalID = j.ID
and
j.UserID = @UserID
COMMIT TRANSACTION
and the code in C# is:
try
{
SqlConnection cnx = new SqlConnection(StudentPortlet.strCnx);
SqlCommand cmd = new SqlCommand();
cmd = new SqlCommand("SelectItem", cnx);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@UserID", SqlDbType.NVarChar).Value = "Unknown";
SqlDataAdapter adap = new SqlDataAdapter(cmd);
DataSet dtt = new DataSet("student senate budget testing");
adap.Fill(dtt);
System.Web.UI.WebControls.DataGrid grid = new System.Web.UI.WebControls.DataGrid();
grid.HeaderStyle.Font.Bold = true;
grid.DataSource = dtt;
grid.DataBind();
dgDisplayItem.DataSource = dtt;
dgDisplayItem.DataBind();
}
catch (Exception ex)
{
string s = ex.ToString();
}
sm
|
|
|
|
|
The problem is right in what you posted " The EXECUTE permission was denied on the object 'SelectItem', database 'Student', schema 'dbo'". What user is your site running as? And what does your connection string look like?
|
|
|
|
|
I defined the connection string in a class and the connection string looks like
public static string strCnx = "server=D324KJ43H2;uid=user;pwd=northpoint;database=Student"
I am login as administrator..
suchita
|
|
|
|
|
Use the following query to give execute permission to the procedure
GRANT EXECUTE TO SelectItem
Gg
http://ggaben-developer.blogspot.com/
|
|
|
|
|
hi
can any one suggest me quickest(optimized) way to call an stored procedure from my c# code for every row of data table (rows can be for example 20000)? what is "optimized" ?
|
|
|
|
|
SqlCommand command = new SqlCommand();
command.Connection = ...
command.CommandText = "sp_name";
command.Paramaters.Add("@paramName, System.Data.SqlTypes.SqlDecimal).Value = 0m; //use correct type param
using(SqlDataReader reader = command.ExecuteReader()){
while(reader.Read()){
//The reader contains the columns of each record
}
}//end using
|
|
|
|
|
Hello,
is there any possible and simple way to convert a Dictionary to a JSON-String an of course to convert it in the other direction (JSON-String to Dictionary)?
I've searched a lot, but i havent't found a simple solution.
Thank you
|
|
|
|
|
You can use Json.NET[^] for the same.
However, I have found one class which converts Dictionary to String that might help you.
class ConvertDictionary
{
Dictionary<string, int> _dictionary = new Dictionary<string, int>()
{
{"salmon", 5},
{"tuna", 6},
{"clam", 2},
{"asparagus", 3}
};
public ConvertDictionary()
{
string s = GetLine(_dictionary);
File.WriteAllText("dict.txt", s);
Dictionary<string, int> d = GetDict("dict.txt");
}
string GetLine(Dictionary<string, int> d)
{
StringBuilder builder = new StringBuilder();
foreach (KeyValuePair<string, int> pair in d)
{
builder.Append(pair.Key).Append(":").Append(pair.Value).Append(',');
}
string result = builder.ToString();
result = result.TrimEnd(',');
return result;
}
Dictionary<string, int> GetDict(string f)
{
Dictionary<string, int> d = new Dictionary<string, int>();
string s = File.ReadAllText(f);
string[] tokens = s.Split(new char[] { ':', ',' },
StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < tokens.Length; i += 2)
{
string name = tokens[i];
string freq = tokens[i + 1];
int count = int.Parse(freq);
if (d.ContainsKey(name))
{
d[name] += count;
}
else
{
d.Add(name, count);
}
}
return d;
}
}
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hi,
I've a listbox having few items. I'm trying to move up a selected item in listbox, using Up button. below is the code in btnUp_Click event. Its working fine. Sometimes, its not working.. In debug mode, its executing all the statements. Please let me where it went wrong.. Thanks in advance.
if (lbAllFields.SelectedIndex > 0)
{
int ndx = lbAllFields.SelectedIndex;
string item = (string)lbAllFields.SelectedItem;
lbAllFields.Items.RemoveAt(ndx);
lbAllFields.Items.Insert(ndx - 1, item);
lbAllFields.SelectedIndex = ndx - 1;
}
|
|
|
|
|
Find following code for the same.
if(ListBox1.SelectedIndex!=0)
{
int i = ListBox1.SelectedIndex;
string s = ListBox1.Items[i].Text;
string s1 = ListBox1.Items[i - 1].Text;
ListBox1.Items[i-1].Text = s;
ListBox1.Items[i].Text = s1;
}
if(ListBox1.SelectedIndex!=ListBox1.Items.Count)
{
int i = ListBox1.SelectedIndex;
string s = ListBox1.Items[i].Text;
string s1 = ListBox1.Items[i + 1].Text;
ListBox1.Items[i+1].Text = s;
ListBox1.Items[i].Text = s1;
}
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Thanks alot.. its working
|
|
|
|
|
I assume that reflection is what I'd need for this but I can't seem to find the necessary information and thought I'd turn to CP.
Let's say I have a class with a few different member variables:
public class myClass
{
public int myInt;
public string myString;
public byte myByte;
}
Now I'd like to access one of the member variables in an instance of the class, based on a string variable available at run time. The following piece of code would do the job but, as you can imagine it would become very unwieldy if the class had a lot of member variables and I'd like to have it more generic anyway.
myClass myInstance = new myClass();
string whichMember;
string myValue;
.
.
.
switch (whichMember)
{
case "myInt": myValue = myInstance.myInt.ToString(); break;
case "myString": myValue = myInstance.myString; break;
case "myByte": myValue = myInstance.myByte.ToString(); break;
}
|
|
|
|
|