|
in my application my application needs to access the db every time and the problem is , do i have to keep the connection open untill the application finishses . or after retreiving data do i have to close the connection each and every time ..
if i'm going to keep the connection open all the time it will affect the concurrency of the db because i'm using ADO.net.
if i'm using the second option i'll have to open the connection each and every time i use the db which will increase the network traffic .
what would be the best option to my application where there are about 30 users.
and i also like to know the standrad way or the most advantageous way of doing this ....
|
|
|
|
|
prasadbuddhika wrote: the connection open all the ti
A drain on the costly system (network) resources.
|
|
|
|
|
If you really need it open all the time, then have it open all the time.
Much of what I write is Windows services; they execute periodically, sleeping between cycles. I open the connections at the start of the cycle and close them at the end of the cycle. There is no need to keep them open while the service is asleep, but I also wouldn't want to have to open and close with each transaction.
|
|
|
|
|
Hi prasadbuddhika,
I suggest to do two things.
1. Ensure that Connection pooling is not disabled in your connection string.( By default this will be enabled).
2) Close the connection as soon as possible.
The reason is when he conenction pool is enabled and you close the connection the connection will not be closed physically thus in that time if another list conenctes with the same connection string SQL will not create a new connection rather then opening a new connection.
Thus you will not have to take the burden of opening more conncection also dont have to pay for time caused to open a new conenction.
Also try using the Sql Profiler to see how many times Sql server needs to open a new conenction.
Thanks
laddie
|
|
|
|
|
Hi All,
I want to create a space After similar values in Excel.For instance...
Column A -------------- column B
11222 A
11222 B
11222 A
11333 C
11333 C
11333 A
11333 B
11228 C
I want to create a space after a new value starts in column A.That is to say to insert an entire row in Excel sheet.So that i vcan group similar datas in Execl together.I have lots of data to group.
Can you please help?
Thanks
|
|
|
|
|
kibromg wrote: Spreed Sheet
Did you mean Spread Sheet?
|
|
|
|
|
Thanks
Yes,But they are generated in C sharp application.
regards
|
|
|
|
|
Hi
could you please see the could below.
/* Product.cs*/
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace Product
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private bool logicalControl()
{
if (txtproductcode.Text == "")
{
MessageBox.Show(this, "Please enter the product code",
this.Text,
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return false;
}
if (txtproductamount.Text == "")
{
MessageBox.Show(this, "Please enter the stock amount",
this.Text,
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return false;
}
if (txtproductprice.Text == "")
{
MessageBox.Show(this, "Please enter the unit price",
this.Text,
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return false;
}
if (grupBox.Text == "")
{
MessageBox.Show(this, "Please enter the group",
this.Text,
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return false;
}
return true;
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void Insertproduct(string pCode, string pName, string pAmount, string pPrice, string pGrup)
{
OleDbCommand cmd = new OleDbCommand("INSERT INTO [Product_List](ProductCode, Brand, Stock, Price, Group) VALUES(@Code, @Brand, @Stock, @Price, @Grup)", Connection.GetConnection());
cmd.Parameters.AddWithValue("@Code", pCode);
cmd.Parameters.AddWithValue("@Brand", pName);
cmd.Parameters.AddWithValue("@Stock", pAmount);
cmd.Parameters.AddWithValue("@Price", pPrice);
cmd.Parameters.AddWithValue("@Grup", pGrup);
cmd.Connection.Close();
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
}
private void btnAdd_Click(object sender, EventArgs e)
{
if (logicalControl() == false)
return;
Insertproduct(txtproductcode.Text, cmbBrand.Text, txtproductamount.Text, txtproductprice.Text, grupBox.Text);
txtproductcode.Text = "";
cmbBrand.Text = "";
txtproductamount.Text = "";
txtproductprice.Text = "";
grupBox.Text = "";
MessageBox.Show("Product Details Saved", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
In this form I have three text box which will take the values only integer.they are
txtproductamount.Text = "";
txtproductprice
grupBox
txtproductamount
I want to control if user enter anything exept Integer it will show error. because they are saved in my database as integer.
please help me if possible.
Thank you
Kamrul Ahsan
Istanbul,Turkey
|
|
|
|
|
You can check it in the keypress event of textboxes and suppress it by setting e.Handled property to true.
|
|
|
|
|
Thank you so much
Kamrul Ahsan
ITU,
Turkey.
|
|
|
|
|
you posted a whole lot of useless code here.
Handle the keypressed event ( as someone said ) and set e.Handled to equal !(Char.IsDigit(e.KeyChar) || Char.IsControl(e.KeyChar))
I may have some variable names wrong, the key thing I wanted to add, is that unless you check Char.IsControl also, your control keys (arrows, delete, etc ) will not work
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
in tne integer class there is a function which will help you to pasre a string to int and it returns true if the casting success .. the method is
int.tryprseint(the variable ) ;
|
|
|
|
|
I want to write a program that,
1. allow user to install softwares on remote computer.
2. & view the desktop of remote computer .
Whether it is possible to write such a software or program using c#.net.
It is possible to write it in c++.net but i want to write it in c#.net
so whether it is possible??? please please please help me.
If possible then what classes or api's are required for it.
Please reply
-- modified at 6:33 Thursday 23rd August, 2007
|
|
|
|
|
Yes, of course it's possible. You'd use the same APIs, if you were going to use C++.NET. If you were just going to use C++, you may find you wanted to use p/invoke to get to the APIs you would use in C++.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thank u sir for suggestions.
Sir i havent used c++.net i only knew that remote screen capture and remote installation is possible in c++.net hene i dont know the api's can u reply me with list of api's required for this application?????
Another problem i faced in c#.net is "DATATYPE CONVERSION"
the problem is that according to MSDN LPTSTR,LPSTR,WORD,DWORD are the datatypes of windows o/s which are directly supported by c++.net
I have invoked the functions in user32.dll , kernel32.dll to standby , restart , shutdown, hibernate the pc but when i tried to create desktop using createDesktop() given in MSDN i faced problem of datatype conversion from c#.net type to windows or c++.net types
I want to know that how to convert such datatypes to c++.net types or windows types
please reply me if u have any table consist of datatype conversion
|
|
|
|
|
Hi everyone,
I'm working on a monitoring app in C# and would like to retrieve the temperatures of various sensors on my motherboard.
I'm specifically interested in the CPU and motherboard temperature sensors.
My first thought was to use WMI to read these values. I've tried the Win32_TemperatureProbe table among others, but the CurrentReading prop is not populated. (More info see MSDN article here)
I've found that the sensors should be accessible through the SMBUS on the mainbord.
So my question to the community: Does anyone know how to read CPU and mainbord temp sensors? Or can you help me to gain access to the SMBus?
I've been told these values should be quite easy to read using some low-level bios access (using assembly), but I'm looking for a way to get these values using C# and .NET 2.0 framework.
Any help would be greatly appreciated!
Thanks in advance!
Tim Wuytens
|
|
|
|
|
|
Thank you!
This could indeed be helpful!
This article explains how to execute assembly code from c#, however I don't know any assembly myself.
Can anyone point me to some information to read the sensors with assembly?
Thanks!
Tim Wuytens
|
|
|
|
|
No I don't know
This might give you a little bit more information http://www.thescripts.com/forum/thread382910.html
|
|
|
|
|
you can collect such datas through ACPI
I recommend to see NHC (Notebook Hardware Control) however it's for notebooks but I installed it on my Desktop and it works! atleast get voltage values and temps
http://www.pbus-167.com/nhc/nhc_advanced.htm[^]
good luck
|
|
|
|
|
DO you know if the developer has managed to get a version working in Vista yet?
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
|
Hi all,
I'm using Microsoft OLEDB Provider to read DBF files. But i just can read the file with less-than-8-character file name.
Accidentally, I installed BDE (Borland Database Engine) and it solved the problem i presented above.
I can't understand.
Hope you helps me to figure it out
Thanks
|
|
|
|
|
Hi!
I create a form, and use usercontrol ( usercontrol just for load a mini image)in that form. I want to move a user control by mouse.
Please! help me!!!!!!!!!!
|
|
|
|
|
Hello,
Look at this thread[^] of the forum!
All the best,
Martin
|
|
|
|