Click here to Skip to main content
15,922,584 members
Home / Discussions / C#
   

C#

 
Questionkeystroke monitor Pin
Dushan12327-Jun-09 23:09
Dushan12327-Jun-09 23:09 
AnswerCROSS POST Pin
dan!sh 27-Jun-09 23:51
professional dan!sh 27-Jun-09 23:51 
AnswerKey-logger Pin
fly90428-Jun-09 0:10
fly90428-Jun-09 0:10 
QuestionRe: keystroke monitor Pin
musefan29-Jun-09 2:45
musefan29-Jun-09 2:45 
AnswerRe: keystroke monitor Pin
EliottA29-Jun-09 3:32
EliottA29-Jun-09 3:32 
QuestionConnection Of Database during installing SETUP Pin
rhtbhegade27-Jun-09 20:32
rhtbhegade27-Jun-09 20:32 
AnswerRe: Connection Of Database during installing SETUP Pin
Arindam Sinha27-Jun-09 22:18
Arindam Sinha27-Jun-09 22:18 
QuestionUnable to Save Array values in database Pin
googlejumbo27-Jun-09 19:24
googlejumbo27-Jun-09 19:24 
Iam Trying to Insert Array values in the database , but first value get inserted but when my loop increments and try to insert the second value iam getting the Error "exSql = {"The variable name '@BezierCusp' has already been declared. Variable names must be unique within a query batch or stored procedure."}Please help me out where iam wrong

SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=localhost;Initial Catalog=InkDb;Integrated Security=True;
Persist Security Info=True;Packet Size=4096";
string qry = "Insert into beziertable values(@strokeIndex,@cuspIndex,@BezierCusp)";
SqlCommand sqlInsertCmd = new SqlCommand(qry, con);
sqlInsertCmd.CommandText = qry;
sqlInsertCmd.CommandType = CommandType.Text;
int count;
int i;
sqlInsertCmd.Parameters.AddWithValue("@strokeIndex", mInkoverlay.Ink.Strokes.IndexOf(stroke));
int cus;
cus = Convert.ToInt16(stroke.BezierCusps.GetValue(0));
sqlInsertCmd.Parameters.AddWithValue("@cuspIndex", cus);
//Using loop to get the all stroke.GetPoint , it will return Array(2dimension) , i want to add all values of array
//In the Database In the parameter Bezier Cusp ,but it show me the error that"exSql = {"The variable name '@BezierCusp' has already been declared. Variable names must be unique within a query batch or stored procedure."}
for (i = 0; i <= 100; i = i + 1)
{
val=stroke.GetPoint(i).X;
sqlInsertCmd.Parameters.AddWithValue("@BezierCusp",val);
sqlInsertCmd.Connection = con;
SqlDataAdapter sqlDataAdapter3 = new SqlDataAdapter();
sqlDataAdapter3.InsertCommand = sqlInsertCmd;
con.Open();
sqlInsertCmd.ExecuteNonQuery();
con.Close();
}
Iam unable to find out the Reason my table structure should be like this after Inserting
Stroke Index Cusp Index Bezeir Cusp
0 0 1st value of array(X componet)
1 1 2nd value of Array
like this it should insert the Record in this manner
tell me there any wrong logic iam using to insert the array values in database

with regards
Genius
AnswerRe: Unable to Save Array values in database Pin
Henry Minute28-Jun-09 8:01
Henry Minute28-Jun-09 8:01 
GeneralRe: Unable to Save Array values in database Pin
googlejumbo28-Jun-09 20:24
googlejumbo28-Jun-09 20:24 
GeneralRe: Unable to Save Array values in database Pin
Henry Minute28-Jun-09 21:55
Henry Minute28-Jun-09 21:55 
GeneralRe: Unable to Save Array values in database Pin
googlejumbo28-Jun-09 22:22
googlejumbo28-Jun-09 22:22 
GeneralRe: Unable to Save Array values in database Pin
Henry Minute29-Jun-09 6:06
Henry Minute29-Jun-09 6:06 
QuestionLeading zero in hex formatting Pin
Trollslayer27-Jun-09 11:56
mentorTrollslayer27-Jun-09 11:56 
AnswerRe: Leading zero in hex formatting Pin
Christian Graus27-Jun-09 12:01
protectorChristian Graus27-Jun-09 12:01 
AnswerRe: Leading zero in hex formatting Pin
Ed.Poore27-Jun-09 12:01
Ed.Poore27-Jun-09 12:01 
GeneralRe: Leading zero in hex formatting Pin
Christian Graus27-Jun-09 12:18
protectorChristian Graus27-Jun-09 12:18 
GeneralRe: Leading zero in hex formatting Pin
Luc Pattyn27-Jun-09 12:31
sitebuilderLuc Pattyn27-Jun-09 12:31 
GeneralRe: Leading zero in hex formatting Pin
Christian Graus27-Jun-09 12:38
protectorChristian Graus27-Jun-09 12:38 
GeneralRe: Leading zero in hex formatting Pin
Ed.Poore27-Jun-09 14:01
Ed.Poore27-Jun-09 14:01 
GeneralRe: Leading zero in hex formatting Pin
Luc Pattyn27-Jun-09 15:07
sitebuilderLuc Pattyn27-Jun-09 15:07 
GeneralRe: Leading zero in hex formatting Pin
Ed.Poore27-Jun-09 23:47
Ed.Poore27-Jun-09 23:47 
GeneralRe: Leading zero in hex formatting Pin
Trollslayer27-Jun-09 13:53
mentorTrollslayer27-Jun-09 13:53 
GeneralRe: Leading zero in hex formatting Pin
Ed.Poore27-Jun-09 14:00
Ed.Poore27-Jun-09 14:00 
GeneralRe: Leading zero in hex formatting Pin
Trollslayer27-Jun-09 14:13
mentorTrollslayer27-Jun-09 14:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.