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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
D

da vinci coder

@da vinci coder
About
Posts
17
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Update command..plz urgnt
    D da vinci coder

    that means there is a syntax error at the query string.. just show code and maybe there would be some help.. good coding

    C# database help announcement

  • a stupid problem about DateTime
    D da vinci coder

    thanx a lot.. good coding

    C# help question discussion

  • a stupid problem about DateTime
    D da vinci coder

    hi guys.. i've never faced with a problem like this, just want to ask u guys.. i declared a datetime component .. DateTime x = new DateTime(1900,01,01,7,0,0,0); everything is fine.. let`s write it to a textbox name tBox; tBox.Text = x.toLongTimeString(); everything is ok.. i get 7:00:00 but after i add some minute to this instance.. x.AddMinute(15); tBox.Text = x.toLongTimeString(); why the heck i get the 7:00:00 instead of getting 7:15:00 ?!?!?! any thoughts ? thanx good coding

    C# help question discussion

  • Login window for cyber cafe SW
    D da vinci coder

    first of all if u dont want to loose focus u have to call the form as a "Dialog".. for e.g.: form myForm = new form() myForm.ShowDialog(); then: if u want to disable close 'X' button.. put the following code inside the class form{} #region disable exit button protected override CreateParams CreateParams { get { CreateParams cp = base.CreateParams; const int CS_DBLCLKS = 0x8; const int CS_NOCLOSE = 0x200; cp.ClassStyle=CS_DBLCLKS | CS_NOCLOSE; return cp; } } #endregion hope this helps.. good coding..

    C# csharp question

  • Sql Scripts in C#
    D da vinci coder

    Hi Guys.. I want to ask if there is a way to use *.sql files generated by MsSql Server (or written by someone )in the C#. For e.g. i have a *.sql file and i want to create tables in my program using this script.. Is there any class in C# or u guys can give me a link ? thx a lot.. good coding..!

    Database csharp database sql-server sysadmin tools

  • problem with Sqlparameters :(
    D da vinci coder

    hi guys.. can anyone tell me what might be the error at the following code ? public void getCounterValue(string countername,string tablename,string email) { SqlConnection conn = null; SqlDataReader reader = null; int result = 0; try { conn = new SqlConnection("Server=(local);Integrated security=SSPI;database=halkdanis"); conn.Open(); SqlCommand cmd = new SqlCommand("select @ctr from @table where @mail = @mail", conn); SqlParameter param = new SqlParameter(); param.ParameterName = "@ctr"; param.Value = countername; SqlParameter param2 = new SqlParameter(); param2.ParameterName = "@table"; param2.Value = tablename; SqlParameter param3 = new SqlParameter(); param3.ParameterName = "@mail"; param3.Value = email; cmd.Parameters.Add(param); cmd.Parameters.Add(param2); cmd.Parameters.Add(param3); reader = cmd.ExecuteReader(); while(reader.Read()) { result = Convert.ToInt32(reader[0]); } } catch(Exception x) { MessageBox.Show(x.ToString()); } finally { reader.Close(); conn.Close(); } } it throws the exception @table doesn`t have a value, but it has the value tablename from the method construction.. any thougts ? thx ! good coding !

    Database help database sysadmin security question

  • Grouping Radio Buttons
    D da vinci coder

    Set the Groupnames same with the other radiobuttons GroupName="a"> GroupName="a"> GroupName="b"> GroupName="b">

    C# question

  • Close Child Form
    D da vinci coder

    lets say the form name which has MdiChild u want to close is market: market.ActiveForm.ActiveMdiChild.Close(); i`m not sure if it works maybe u can give more detailts about the code

    C# help question debugging

  • my problem with ado.net
    D da vinci coder

    hi guys.. my problem is like this.. i have a query which is : string query = "select count(*) AS [username] from [" + tablename + "] WHERE username = '"+username+"'"; and my method is : public void checkIfUserExists(string username,string tablename) as u can see, i want to check how many user exists with this username in the database, i want to execute the query, and take the result inside an int ( e.g. int result ) if the result is > 0 , then i won`t allow user to choose that username else user can register.. how can i do this ? it was easy doing that at php but i cant do this in c# because i can`t understand ado.net very well ( datasets, datagrids,etc..) any help would be great! thx! good coding !

    Database csharp database help question php

  • active form name problems..
    D da vinci coder

    it works :) thx so much :)

    C# help sql-server

  • active form name problems..
    D da vinci coder

    ok my problem is.. when i enter this code inside the load event it returns the name of the form opened before this form.. private void editForm_Load(object sender, System.EventArgs e) { MessageBox.Show(ActiveForm.Name.ToString()); } which returns AdminPanel ( which is the previous form ) but what i want is to see editForm ( which is the form i'm currently opening ) i know its because the form is loading and thats why the currently activeform is AdminPanel but i need to see editForm because: i have a listbox which gets data from mssql and puts the data to listbox, and someforms of i use are inherited from editForm so while this editForm is loading i want to fetch the data from the unique table so i can see the datas in the listbox after the form is loaded so my code should be something like this.. private void editForm_Load(object sender, System.EventArgs e) { Classes.editClass eC = new HalkDanisv03.Classes.editClass(); // create new object if(ActiveForm.Name.ToString() == "editEmployee") { eC.getStaffUsername(xList,"employeeinfo"); // employeeinfo is the name of the tablename } else if(ActiveForm.Name.ToString() == "editManager") { eC.getStaffUsername(xList,"managerinfo"); //managerinfo is the name of the tablename } } any help would be great.. thx guys.. good coding

    C# help sql-server

  • How can i use infinite parameters in a method
    D da vinci coder

    ok my problem is like this.. i want to make a method for clearing textbox`s in a form and the method looks like this.. public void clearTextBox(TextBox a, TextBox b) { a.Text=""; b.Text=""; } of course it will clear only two textbox`s which i decleared.. but i want my method to clear n textbox so i can use this method several times.. how should the code look like ? i remember from c++ it should be something like this but its not working at c#: public void clearTextBox(TextBox a,...,Textbox b); any help would be great.. thanx guys.. good coding..

    C# help question csharp c++ learning

  • problem using a function for several tablenames
    D da vinci coder

    awesome !!! thank you so much.. it works ! ;)

    C# help database sql-server sysadmin security

  • problem using a function for several tablenames
    D da vinci coder

    my mssql server and everything seems fine, this is just a function of the system, i can add, delete, update records on my program right now and there is no problem, what i wanted to do is, i'm using this code 5 times in the program but each time i have to specify the tablename , so i had to use 5 functions only the tablenames are different. and instead of doing like that i wanted to use only one function and take the tablename as a string so i could use it.. try { SqlDataReader reader = cmd.ExecuteReader(); // error points here while(reader.Read()) ... when i do like this , it gives error like where the heck is the reader but SqlDataReader reader = cmd.ExecuteReader(); // error points here try { while(reader.Read()) ... no errors but when i wanted to use the function it gives sql error and points SqlDataReader reader = cmd.ExecuteReader(); thanks for your help but i guess i have to use 5 function grrr :)

    C# help database sql-server sysadmin security

  • problem using a function for several tablenames
    D da vinci coder

    public static void test(ListBox lst, string tablename) { string str = "Select [username] from @table"; SqlConnection myConn = new SqlConnection("Server=(local);Integrated security=SSPI;database=halkdanis"); SqlCommand cmd = new SqlCommand(str,myConn); cmd.Parameters.Add("@table",tablename); myConn.Open(); SqlDataReader reader = cmd.ExecuteReader(); // error points here try { while(reader.Read()) { lst.Items.Add(reader.GetString(0)); //since we only asked for one colume, just get string from col 0 } } finally { reader.Close();//close reader myConn.Close();//close connection } } An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll Additional information: System error. and i coulnt take take SqlDataReader reader = cmd.ExecuteReader(); in a try - catch block coz it gives `reader` couldnt find errors .. my usage of the function is.. defaultCheck.test(empList,"employeeinfo"); // empList = listBox , "employeeinfo" = tablename thx.

    C# help database sql-server sysadmin security

  • problem using a function for several tablenames
    D da vinci coder

    this is still not working... string str = "Select [username] from @table"; SqlConnection myConn = new SqlConnection("Server=(local);Integrated security=SSPI;database=halkdanis"); SqlCommand cmd = new SqlCommand(str,myConn); cmd.Parameters.Add("@table",tablename); myConn.Open(); SqlDataReader reader = cmd.ExecuteReader(); // here it sais error try { while(reader.Read()) { lst.Items.Add(reader.GetString(0)); //since we only asked for one colume, just get string from col 0 } } finally { reader.Close();//close reader myConn.Close();//close connection } and i also tried myStyle with parameters.. string str = "Select * from @table"; SqlDataAdapter dataAdapter = new SqlDataAdapter(str,myConn); dataAdapter.SelectCommand.Parameters.Add("@table", tablename); gives the same error DataAdapter.Fill(dt,tablename); // error here..

    C# help database sql-server sysadmin security

  • problem using a function for several tablenames
    D da vinci coder

    ok.. i have a function and it looks like this.. public static void test(ListBox lst,string tablename) { string myConn = "Server=(local);Integrated security=SSPI;database=halkdanis"; string str = "SELECT * FROM '"+tablename+"'"; SqlDataAdapter dataAdapter = new SqlDataAdapter(str,myConn); DataSet dt = new DataSet(); DataAdapter.Fill(dt,tablename); // here it says error DataTable dtb = dt.Tables[0]; foreach(DataRow dtr in dtb.Rows) { lst.Items.Add(dtr["username"]); } } as u can see, i want to get data from mssql, and put the usernames in a listbox and i want to use this function several times depends on tablenames but it gives error at: DataAdapter.Fill(dt,tablename) ; i guess its coz of `"` char or dunno what is it.. any help would be great.. thx. good coding.. god is a coder..

    C# help database sql-server sysadmin security
  • Login

  • Don't have an account? Register

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