4
Answers

insert method using database

tAhIra sgd

tAhIra sgd

14y
2.7k
1

i want to use insert query by using SQL server 2005.  I MAKE TABLE in sql server nad give them name of column but this is not giving proper output..

plz check what is the problem





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
namespace insert_method
{
class Program
{
static void Main(string[] args)
{
string constring ="Server=LAB02-19\SQLEXPRESS;Database=insert";
SqlConnection conn = new SqlConnection();
SqlCommand cmd;
conn.Open();
string Sql="Insert into info values" (stname , rollnum);
insert table_1(ali','1');
int a= cmd.ExecuteNonQuery();

}
}
}
Answers (4)
0
Gavin Roberts
NA 3 0 19y

try this:

  private ArrayList Keys = new ArrayList();
  private void InvWiz0_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
  {
     Keys.Add(e);
  }


this "i think" will capture each key you press on the keyboard and add it to an arraylist. As I have added the whole KeyEventArgs object, you will be able to go through and view each one and it's properties.

You have to cast it back to an KeyEventArgs when reading tho.

ie.

object[] Keys_Ar = Keys.ToArray();
foreach(KeyEventArgs Key in Keys_Ar)
{
}

or

object[] Keys_Ar = Keys.ToArray();
for(int i = 0; i < Keys_Ar.Length; i++)
{
   ((KeyEventArgs)Keys_Ar[i]).property
}

P.S I hope you are not looking to use this as a keylogger.!

Gav

0
Ed
NA 3 0 19y
Thanx for reply, it helped a lot, but Instill cant make it work, could you post a little example? Thank you
0
Andrzej Wegierski
NA 705 0 19y
Override Your control - OnKey...() or ProcessKey...() protected methods.
In OnKey... KeyEventArgs see Handled property.
Remember method arguments in Your own buffer to future use - string isn't good to remember all keyboard input (shift, control, alt modifiers etc)