|
Colin Angus Mackay,
Thanks for you quick response, I dont want to prevent the services of OS, I just dont want to give access to the user for other applications except the one. how to prevent the user to access all other applications except the one application (running)? could you please help in this issue?
Thanks
SMARTech
|
|
|
|
|
You can't do it from your code. This is something that's done using Group Policy in Windows. You can specify a list of applications that the user, or group of users, is allowed to run. THis is NOT something you can just turn on and off only when your application runs.
For further information, pickup the Windows XP or Windows 2003 Resource Kit. Group Policy is explained in there, taking up about half the book.
|
|
|
|
|
That sounds extremely user-hostile; don't expect anyone to want to use your application.
|
|
|
|
|
Hello,
My intention is not to force the user to use my application, but to give the access for only one application. Except that, the user could not open other applications on the system.
Thanks,
SMARTech
|
|
|
|
|
shah_tech wrote: My intention is not to force the user to use my application, but to give the access for only one application. Except that, the user could not open other applications on the system.
So forcing the user to user your application once it's running, even if it's only to turn the damn thing off. Sorry, but this sounds like malware - you are running totally contra to what a multitasking system should do. You still haven't explained why you would WANT to write an application that did this? Why do you want to alienate users?
|
|
|
|
|
So they can't even check their email while using it?
They can't lock the system for a potty break?
They would have to exit your app to do something else for a moment and then get back in?
If it hangs they can't get to the Task Manager to kill it?
|
|
|
|
|
yes, they should not be allowed for other applications while running my application, Can you please help?
|
|
|
|
|
I wouldn't even if I could. No one would want to use such a system. I certainly wouldn't, would you?
|
|
|
|
|
I created a MDI form & its child,
On child form I am doing database interaction and loading
the datatable object with table name "table1".
after doing all this when i run the MDI form & open up the child from,
its giving the following error:
"Cannot create a child list for the field table1"
Will anyone tells me the reason, or how to rectify this?
Thanks & regards to all.
|
|
|
|
|
|
Here somthing more if u can help?
When i try developing the same application using the VS designer its working fine, I created the MDI form, on its child form thru connection wizard i created the connection, dataadapter, dataset.
And write the correponding code for manipulating the data on child form,
everything working fine.
But when i am doing this thru coding, error is generating which i had mention earlier.
What i am doing is:
-> created a seprate class, on this creating the DB connectivity,
-> create the commandBuilder object, and the GetUpdateCommand, GetUpdateDelete, GetUpdateInsert.
-> filling the datatable object, returning it to child form class file.
on child class file performing the function.
Also when i compare the VS designer code & my code, some lines i am unable to understand like:
((System.ComponentMode1.IsupportIntialize)(this.dsComp)).BeginInit();
((System.ComponentMode1.IsupportIntialize)(this.dsComp)).EndInit();
And also i want to know what is difference when we creating DB connection thru wizard & connection thru coding?
which method one should use?
|
|
|
|
|
I'm using SQL Server 2005 as backend for C#.Net 2005. When I am trying to connnect the database which is in other system, it thrown the following exception..
"Login failed for user ''. The user is not associated with a trusted SQL Server connection."
Connection string is
SqlConnection conn = new SqlConnection("Data Source=Danny\\SQLExpress;initial catalog=Games;trusted_connection=true;user=sa;pwd=lalitha");
Please guide me to solve this..
Regards,
Lalitha.
modified on Thursday, February 21, 2008 6:26 AM
|
|
|
|
|
Hi,
you have connection string:
Connection string is
SqlConnection conn = new SqlConnection("Data Source=Danny\\SQLExpress;initial catalog=Games;trusted_connection=true;user=sa;pwd=lalitha");
you have given trusted_connection=true, given user and password details.
If you have access to Sql server with windows authentication, you should provide trusted_connection=true in connection string,
else you have to provide user and pwd details.
your connection string should be in either formats:
1. Data Source=Danny\\SQLExpress;initial Catalog=Games;trusted_connection=true
2. Data Source=Danny\\SQLExpress;initial Catalog=Games;user=sa;pwd=lalitha
If you specify trusted_connection=true, you need not to give user and pwd details.
I think you dont have windows authentication for SQL server, so you are getting error like above.
try with 2nd option of connection string, it should work
All the best!
|
|
|
|
|
|
Good idea removing that IP address
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Hello Lalitha,
The SQL Server seems to be configured for Windows Authentication and you are trying to connect to the server using SQL Login. Either Change the Authentication mode to Mixed Mode or Connect using your domain account
http://support.microsoft.com/kb/555332
Regards,
Dave
Dave Traister
Software Engineer
ComponentOne LLC
www.ComponentOne.com
|
|
|
|
|
Has anyone used NetworkStreams asynchronously? How do things change if you wrap the NetworkStream in an SSLStream?
Can I run two threads using the same stream calling receive and send on it at the same time or will I have to use async callbacks?
|
|
|
|
|
I don't know the answer to your first question, but to answer your second question, streams are not thread safe, so no, you cannot read and write to it in parallel using 2 threads. You would need to do it on a single thread using message posting or callbacks, or using locking so that both threads don't try to access the stream simultaneously.
|
|
|
|
|
Hi there,
I had download a C# code for connecting a mobile with a computer using the bluetooth,
but I had for the first time see these :
using System.Linq;
using C4F.DevKit.Bluetooth.DeviceAndServiceDiscovery;
using system.core;
using system.data.datasetextensions;
I know I have to download the appropriate library, I have searched the net but I could not successfully find'm
if you know where can I download them from , please send me back as soon as possible
Thank you , your help is valuable .
There is always something to learn
There is always something to learn
|
|
|
|
|
Try downloading Visual C# 2008 Express. The C4F is the coding for fun stuff that MS has released, and the other items are part of .NET 3.5.
|
|
|
|
|
thanks for replaying
I am using .Net Visual Studio 2005 , and I was wondering if there is some thing to be downloaded can enable me to run the program ?
In other word what can I do to run the program using .Net 2005
?
There is always something to learn
|
|
|
|
|
Rewrite it. If it's using things like Linq then it's either using the Beta Orcas stuff or it's a .NET 3.5 application. Alternatively, you could upgrade to VS 2008 (the Express editions are free and available to use now).
|
|
|
|
|
hi friends,Im using validation summary,and i set ShowMessageBox=true.it Shows msgbox,but i cant focus to first control what it lists me...i would like set focus..how can i do it my friend?
Hi,Im Razana
|
|
|
|
|
this.ActiveControl = myControl;
Where myControl is any control such as a button, textBox etc.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
// ASCX file
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class PresentationLayer_Controls_ManagePaymentDetailsControl : System.Web.UI.UserControl
{
Payment ObjXMLData = new Payment();
public static int editstatus =0;
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
Session["update"] = Server.UrlEncode(System.DateTime.Now.ToString()); // to avoid page refresh problem
//string opno = "0p005";
//txtOpno.Text = opno;
txtDate.Text = ObjXMLData.ConvertDate(DateTime.Today.Date.ToString().Substring(0, 10));
txtDate.Text = txtDate.Text.Substring(3, 2) + "/" + txtDate.Text.Substring(0, 2) + "/" + txtDate.Text.Substring(6, 4);
try
{
//GetData(opno, Server.MapPath("Amount.xml").ToString());
BindGrid();
}
catch (Exception ex)
{
lbl_Error.Text = ex.Message;
}
}
}
catch (Exception ex)
{
string s = ex.Message;
}
}
public void GetData(string opno, string path,int estatus)
{
try
{
DataSet ds;
DataTable dt = ObjXMLData.GetByOpNo(opno, path);
if (dt.Columns.Count > 0)
{
if (estatus == 1)
{
txtOpno.Text = dt.Rows[0].Table.Rows[0]["OpNo"].ToString();
txtName.Text = dt.Rows[0].Table.Rows[0]["Name"].ToString();
txtPaidAmount.Text = dt.Rows[0].Table.Rows[0]["PaidAmount"].ToString();
txtTotalAmount.Text = dt.Rows[0].Table.Rows[0]["TotalAmount"].ToString();
txtBalanceAmount.Text = dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString();
}
else
{
txtOpno.Text = dt.Rows[0].Table.Rows[0]["OpNo"].ToString();
txtName.Text = dt.Rows[0].Table.Rows[0]["Name"].ToString();
//txtPaidAmount.Text = dt.Rows[0].Table.Rows[0]["PaidAmount"].ToString();
//txtTotalAmount.Text = dt.Rows[0].Table.Rows[0]["TotalAmount"].ToString();
txtBalanceAmount.Text = dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString();
}
}
else
{
string msg = "<script type='text/javascript'>alert('No Records Found');</script> ";
Page.ClientScript.RegisterStartupScript(this.GetType(),"msg",msg);
}
}
catch (Exception ex)
{
string s = ex.Message;
}
}
public void BindGrid()
{
try
{
DataTable dt = null;
dt = ObjXMLData.GetAll(Server.MapPath("Amount.xml").ToString());
if (dt.Rows.Count != 0)
{
DataGrid1.DataSource = dt;
DataGrid1.DataBind();
lblcount.Text = "Total No of Records:" + dt.Rows.Count;
int pindex = DataGrid1.CurrentPageIndex + 1;
lblpageindex.Text = "Page" + pindex + " of " + DataGrid1.PageCount.ToString();
}
else
PageList.Attributes.Add("style", "display:none");
}
catch (Exception ex)
{
lbl_Error.Text = ex.Message;
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
try
{
DataTable dt = ObjXMLData.GetByOpNo(txtOpno.Text.Trim().ToUpper(), Server.MapPath("Amount.xml").ToString());
Double Result;
string totalamount;
if (Session["update"].ToString() == ViewState["update"].ToString()) // to avoid page refresh problem
{
if (CheckBox1.Checked == false)
totalamount = dt.Rows[0].Table.Rows[0]["TotalAmount"].ToString();
else
totalamount = txtTotalAmount.Text;
if (Convert.ToDouble(totalamount) >= Convert.ToDouble(txtPaidAmount.Text))
{
if (CheckBox1.Checked == true)
{
Result = ObjXMLData.Update(txtOpno.Text.ToUpper(), DateTime.Now.ToString(), txtName.Text,
Convert.ToDouble(txtTotalAmount.Text) + Convert.ToDouble(txtBalanceAmount.Text), (Convert.ToDouble(dt.Rows[0].Table.Rows[0]["PaidAmount"].ToString()) + Convert.ToDouble(txtPaidAmount.Text)),
Convert.ToDouble(Convert.ToDouble(dt.Rows[0].Table.Rows[0]["TotalAmount"].ToString()) - (Convert.ToDouble(dt.Rows[0].Table.Rows[0]["PaidAmount"].ToString()) + Convert.ToDouble(txtPaidAmount.Text))), Server.MapPath("").ToString());
}
else
{
Result = ObjXMLData.Update(txtOpno.Text.ToUpper(), DateTime.Now.ToString(), txtName.Text,
Convert.ToDouble(dt.Rows[0].Table.Rows[0]["TotalAmount"].ToString()), (Convert.ToDouble(dt.Rows[0].Table.Rows[0]["PaidAmount"].ToString()) + Convert.ToDouble(txtPaidAmount.Text)),
Convert.ToDouble(Convert.ToDouble(dt.Rows[0].Table.Rows[0]["TotalAmount"].ToString()) - (Convert.ToDouble(dt.Rows[0].Table.Rows[0]["PaidAmount"].ToString()) + Convert.ToDouble(txtPaidAmount.Text))), Server.MapPath("").ToString());
}
if (Result >= 1)
{
lbl_Error.Text = " Trasaction Status : Success ";
BindGrid();
}
else
{
lbl_Error.Text = " Transaction Status : Fail ";
}
}
else
{
lbl_Error.Text = " Transaction Status : Fail ";
}
}
}
catch (Exception ex)
{
string s = ex.Message;
}
}
protected void Page_PreRender(Object s, System.EventArgs e)
{
ViewState["update"] = Session["update"];
}
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e)
{
if (e.CommandName == "Editing")
{
editstatus = 1;
CheckBox1.Checked = true;
total.Attributes.Add("style", "Display:block");
GetData(e.CommandArgument.ToString(), Server.MapPath("Amount.xml").ToString(), editstatus);
}
}
protected void btnReset_Click(object sender, EventArgs e)
{
editstatus = 0;
txtBalanceAmount.Text = "";
txtOpno.Text = "";
txtPaidAmount.Text = "";
txtTotalAmount.Text = "";
txtName.Text = "";
}
protected void txtOpno_TextChanged(object sender, EventArgs e)
{
if (txtOpno.Text != "")
{
editstatus = 0;
GetData(txtOpno.Text.Trim().ToUpper(), Server.MapPath("Amount.xml").ToString(), editstatus);
}
}
protected void txtTotalAmount_TextChanged(object sender, EventArgs e)
{
DataTable dt = ObjXMLData.GetByOpNo(txtOpno.Text.Trim().ToUpper(), Server.MapPath("Amount.xml").ToString());
if (editstatus == 0)
{
if (txtTotalAmount.Text.Trim() != "" && txtPaidAmount.Text.Trim() != "" && CheckBox1.Checked == true)
txtBalanceAmount.Text = Convert.ToString((Convert.ToDouble(txtTotalAmount.Text) + Convert.ToDouble(dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString())) - Convert.ToDouble(txtPaidAmount.Text));
else if (txtPaidAmount.Text.Trim() != "")
txtBalanceAmount.Text = Convert.ToString(Convert.ToDouble(dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString()) - Convert.ToDouble(txtPaidAmount.Text));
else
txtBalanceAmount.Text = dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString();
}
else
{
if (txtTotalAmount.Text.Trim() != "" && txtPaidAmount.Text.Trim() != "")
txtBalanceAmount.Text = Convert.ToString(Convert.ToDouble(txtTotalAmount.Text) - Convert.ToDouble(txtPaidAmount.Text));
else
txtBalanceAmount.Text = dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString();
}
}
protected void txtPaidAmount_TextChanged(object sender, EventArgs e)
{
DataTable dt = ObjXMLData.GetByOpNo(txtOpno.Text.Trim().ToUpper(), Server.MapPath("Amount.xml").ToString());
if (editstatus == 0 )
{
if (txtTotalAmount.Text.Trim() != "" && txtPaidAmount.Text.Trim() != "" && CheckBox1.Checked == true)
txtBalanceAmount.Text = Convert.ToString((Convert.ToDouble(txtTotalAmount.Text) + Convert.ToDouble(dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString())) - Convert.ToDouble(txtPaidAmount.Text));
else if (txtPaidAmount.Text.Trim() != "")
txtBalanceAmount.Text = Convert.ToString(Convert.ToDouble(dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString()) - Convert.ToDouble(txtPaidAmount.Text));
else
txtBalanceAmount.Text = dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString();
}
else
{
if (txtTotalAmount.Text.Trim() != "" && txtPaidAmount.Text.Trim() != "")
txtBalanceAmount.Text = Convert.ToString(Convert.ToDouble(txtTotalAmount.Text) - Convert.ToDouble(txtPaidAmount.Text));
else
txtBalanceAmount.Text = dt.Rows[0].Table.Rows[0]["BalanceAmount"].ToString();
}
}
protected void DataGrid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
{
try
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
int pindex = DataGrid1.CurrentPageIndex + 1;
lblpageindex.Text = "Page" + pindex + " of " + DataGrid1.PageCount.ToString();
BindGrid();
}
catch (Exception ex)
{
string s = ex.Message;
}
}
protected void ddlpagecount_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
DataTable dt = null;
dt = ObjXMLData.GetAll(Server.MapPath("Amount.xml").ToString());
DataGrid1.CurrentPageIndex = 0;
if (ddlpagecount.SelectedValue == "All")
{
DataGrid1.PageSize = dt.Rows.Count;
}
else
{
DataGrid1.PageSize = Convert.ToInt32(ddlpagecount.SelectedValue);
}
BindGrid();
int pindex = DataGrid1.CurrentPageIndex + 1;
lblpageindex.Text = "Page" + pindex + " of " + DataGrid1.PageCount.ToString();
}
catch (Exception ex)
{
string s = ex.Message;
}
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
if(CheckBox1.Checked == true)
total.Attributes.Add("style","Display:block");
else
total.Attributes.Add("style", "Display:none");
}
}
srinivas
|
|
|
|
|