Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

teknolog123

@teknolog123
About
Posts
146
Topics
54
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Consuming sqlcompact connection with using statement
    T teknolog123

    thanks Eddy, by the way, is it only those that are written in parentheses disposed or anything in curly braces?

    C# database question

  • Consuming sqlcompact connection with using statement
    T teknolog123

    thanks let me explain more. I just want to dispose sqceConnection, sqlceCommand, SqlCeCommandBuilder and sqlceAdapter as soon as I finish processing the data. for example does the below code dispose the objects in that manner? I think no but wanna make sure. (note: I didn't use sqladapter and commnadbuilder below to keep the code short on purpose)

    public SqlCeConnection sqlSetCon()
    {
    SqlCeConnection sqlCon = new SqlCeConnection();
    sqlCon.ConnectionString = Properties.Settings.Default.sqlConnStr;
    sqlCon.Open();
    return sqlCon;
    }
    public DataTable returnDataTable(string selectString)
    {
    SqlCeDataAdapter sqlAdaptor = new SqlCeDataAdapter(selectString, sqlSetCon());
    SqlCeCommandBuilder sqlKomut = new SqlCeCommandBuilder(sqlAdaptor);
    DataTable dtTablo = new DataTable();
    sqlAdaptor.Fill(dtTablo);
    return dtTablo;
    }

        private void processList()
        {
           //does this using block dispose everything?
            using (DataTable dt = returnDataTable("Select \* From Customers Order By Surname"))
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    this.lblSurname.Text = dt.Rows\[i\]\["surname"\].ToString();
                }
            }
        }
    
    C# database question

  • Consuming sqlcompact connection with using statement
    T teknolog123

    hi, I use below code to create/consume and dispose sql connections.But as there are more than twenty methods/functions that I use it, same code block repeats. So, is it goog practice? Your valuable comments are welcomed.

    private void islemKayitlariniYukle(string select)
    {
    using (SqlCeConnection sqlCEBaglantisi = new SqlCeConnection(Properties.Settings.Default.sqlBag))
    using (SqlCeDataAdapter sqlAdaptor = new SqlCeDataAdapter(select, sqlCEBaglantisi))
    using (DataTable dtTablo = new DataTable())
    {
    sqlCEBaglantisi.Open();
    sqlAdaptor.Fill(dtTablo);

                        SqlCeCommand islemTipleriniAl = new SqlCeCommand("Select IslemTipi From IslemKaydi Group By IslemTipi", sqlCEBaglantisi);
                        using (SqlCeDataReader oku1 = islemTipleriniAl.ExecuteReader())
                        {
                            while (oku1.Read())
                            { cmbIGIslemTipiSec.Items.Add(oku1.GetString(0).Trim()); }
                        }
    
    C# database question

  • Sql Compact Deployment with C#
    T teknolog123

    hi, I have a VS2010 setup project. I deploy my project with sql compact dlls' so that the target pc doesnt have to have sql compact installed. I did what's said in this link under Private File–Based Deployment ( http://msdn.microsoft.com/en-us/library/aa983326.aspx[^] But, even my program can be installed on the target pc, it doesn't run without sql compact installed. Do I miss something? Thanks.

    C# csharp database com sysadmin question

  • Selecting/Deselecting items by checking checkboxes in a listview impossible?
    T teknolog123

    Matt U. wrote:

    May I ask why the items must be checked/unchecked AND selected/deselected?

    C# question

  • Selecting/Deselecting items by checking checkboxes in a listview impossible?
    T teknolog123

    Winfoms.Listview

    C# question

  • Selecting/Deselecting items by checking checkboxes in a listview impossible?
    T teknolog123

    hi, I almost tried everything but couldn't make the listview items be selected when checkbox checked and deselected when unchecked. Am I asking for an impossible thing? Checking the boxes to select is fine but when I uncheck any of the items, all of them are unselected. I didn't eat my brain with more complicated problems but this one will make me do it

    C# question

  • Form.Show() in a backgroundworker doesn't work
    T teknolog123

    thank you very much. At least, I got to know that all UI actions must be executed within the same thread.

    C# question

  • Form.Show() in a backgroundworker doesn't work
    T teknolog123

    hi, Whenever I start a instance of a form with frm.Show() from a backgroundworkder or a thread other than the mainform's thread like the sample below, the new form is unstable. but it's okay with frm.ShowDialog(). I want to use frm.show() because the code don't stop and wait for the user action. Any idea about it?

    //this way, the frm hangs
    private void bgworker_DoWork(object sender, DoWorkEventArgs e)
    {
    NewWindow frm=new NewWindow(); //this is not the main form
    frm.Show();
    }

    //this way it's okay
    private void bgworker_DoWork(object sender, DoWorkEventArgs e)
    {
    NewWindow frm=new NewWindow(); //this is not the main form
    frm.ShowDialog();
    }

    C# question

  • WCF server don't detect lost or broken connection?
    T teknolog123

    jschell wrote:

    This is how TCP works. And there is no magical way to get around it.

    you really cleared the confusion with this info. Thanks

    C# question csharp wcf sysadmin learning

  • WCF server don't detect lost or broken connection?
    T teknolog123

    BobJanova wrote:

    Like all HTTP based web services, WCF doesn't really have the concept of a connection, so if you care, you need to do something like what you describe. Alternatively, you can just let the HTTP session expire if a user disappears.

    sorry for not mentioning. This is a cybercafe software(netTcpBinding based persession scenario and server/client on the same lan).

    BobJanova wrote:

    If your service is doing something for which manual inspection of requests is necessary

    by approval, I mean, client is sending me drink orders which opens up a form on server side and admin approves or cancels. This is where the story begins.If I don't approve in ten seconds(closetimeout=10) connection is broken. in order to avoid this, I create a backgroundworker for every session that listens incoming orders and handles the approval form, this way connection isn't dropped. But this time there are too many unnecessary backgroundworkers with extra load(think of 25+ clients/sessions) Also, same approval mechanism needed for clients for requests from server to clients and same load So, Do you have any better idea?

    C# question csharp wcf sysadmin learning

  • WCF server don't detect lost or broken connection?
    T teknolog123

    PIEBALDconsult wrote:

    why the server would care about how frequently a client calls methods.

    Client needs to get the updated data every three seconds and server already is fine with that but that isn't the problem. If I don't use closetimeout property, client seems connected even if down.Because wcf service do not tell me whether client is still connected. And with this property set, server drops the connection and I am able to know when connection goes. All I want is to know when connection is lost

    C# question csharp wcf sysadmin learning

  • WCF server don't detect lost or broken connection?
    T teknolog123

    Hi, I have a working wcf server-client application.Client makes a call every 3 seconds.If client doesn't call any method for ten seconds, server drops the connection based on the closetimeout setting(10 secs).(not prefer but with this setting, if something happens to client like ethernet/power plug off, I detect lost connection) But as a side effect of this, if server's response time exceeds 10 secs(like a messagebox asking for a user confirm.), the client is waiting and the connection is gone of course, because client can't make another call until the previous one answered.(InstanceContextMode=PerSession) Oddly,it is said that setting a void method as "IsOneway=true" the client doesn't wait for server to finish process and so it can make another call. But it's not so in action, it still waits server to finish. ??? The question is: I want to get rid of closetimeout setting by setting it to int.maxvalue and detect lost connections by service or instance faults.Any way of doing this? (I tried the closed and faulted events of operationContext...etc with no success) (I didn't try faultContract because I don't want to send fault details to clients(am I wrong about this?). I only want whether the client is connected or not)

    C# question csharp wcf sysadmin learning

  • Nested foreach is a bad practice?(please read)
    T teknolog123

    thanks for the detailed explanation.I solved the problem already but you gave me an idea about future problems. Regards...

    C# data-structures question discussion

  • Nested foreach is a bad practice?(please read)
    T teknolog123

    this is it! Thank you very much for your help

    C# data-structures question discussion

  • Nested foreach is a bad practice?(please read)
    T teknolog123

    my variables are already initialized and code is already working and doing its job, I just wanted to ask whether it's good practice.Because nested foreach seemed to much code to me. Thanks

    C# data-structures question discussion

  • Nested foreach is a bad practice?(please read)
    T teknolog123

    hi, I'm using the below code to close some programs.But it seems like it's not the best practice. would you recommend me anything better? Thanks.

    Process[] runningProcesses; //contains all running processes
    Queue programsToBeClosed; //contains only string objects
    public void closePrograms(Queue programsToBeClosed)
    {
    foreach (string program in programsToBeClosed)
    {
    foreach (Process item in runningProcesses)
    {
    try //not to break loop when item couldn't be killed
    {
    if (item.ProcessName == program || item.MainWindowTitle == program)
    {
    item.Kill();
    }
    }
    catch (Exception)
    {
    }
    }
    }

    }

    C# data-structures question discussion

  • Some data gets lost between WCF server and client
    T teknolog123

    thanks.

    C# question csharp wcf sysadmin data-structures

  • Some data gets lost between WCF server and client
    T teknolog123

    hi, I'm sending text+numbers from a wcf client to a wcf server in a multidimensional array. The data arrives but if I'm sending eg. "4 Drinks" it arrives as "1 Drinks" (what ever the number is, it arrives as 1) This happens frequently and sometimes it arrives without any change. I tried a special class instead of array but it's the same. So I think WCF has a problem. The question is: -Do I need to use message security to solve it? Or your recommendation? - if yes, does mes.security have bad impact on performance? Thanks for reading, would appreciate if answered

    C# question csharp wcf sysadmin data-structures

  • Selecting multiple controls by mouse
    T teknolog123

    BillWoodruff wrote:

    Have you written your selection code already ?

    Yes I did but not the way I wanted. What I wanted was to click on a control and move the mouse to the others (with the help of a visible selection rectangle) to select the controls which intersect with the selection rectangle What I did : I click the panel that contains all those controls (with a selection rec. visible only on the panel not the controls) and move the mouse.Intersection with rectangle logic is same the point is I don't want to enlarge the panel to leave a clicking space for selection.The panel should be invisible behind the controls

    C# question tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups