|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#16
|
||||
|
||||
|
Quote:
Code:
cmd.Parameters.AddWithValue("@ID", NgramID);
cmd.Parameters.AddWithValue("@JezikID", JezikID);
cmd.Parameters.AddWithValue("@bigram_broj", ngram.Count);
cmd.Parameters.AddWithValue("@bigram_txt", BrojZnakova);
cmd.ExecuteNonQuery();
JeromeJr, "didnt help" means what? Did you get any error? |
|
#17
|
|||||
|
|||||
|
in debugger all values are fine after each loop
"select" query collect all id's where bigrams (characters) are saved in table, but update wont work, i try to test every field and value and here is one of tests example: i insert into textbox - "ja ti on" and it saves bigrams like this in table Quote:
and then after Quote:
i have Quote:
but he wont update even he collects ID's of bigrams? and thats really weird |
|
#18
|
||||
|
||||
|
Quote:
Actually I wasn't. The @ is only to declare the name of the parameter, you don't need to use it when refering to it or assigning it a value. Promise I always use parameters now (to protect from SQL Injection of course) and I've never once used them with the @ in the addwithvalue clause. But of course you have to when declaring the parameter in the sql statement.Now I have no clue if it can work both ways, with the @ or without - I've never tried with the @... but I know it works without for sure ![]() Last edited by Rictor : October 26th, 2009 at 01:18 PM. |
|
#19
|
||||
|
||||
|
Quote:
So what happened? Same thing as the original.... pretends to update but never changes anything in the database? |
|
#20
|
|||
|
|||
|
after
Code:
cmd.Parameters.AddWithValue("@ID", NgramID);
cmd.Parameters.AddWithValue("@JezikID", JezikID);
cmd.Parameters.AddWithValue("@bigram_broj", ngram.Count);
cmd.Parameters.AddWithValue("@bigram_txt", BrojZnakova);
cmd.ExecuteNonQuery();
query updates in new field, so therefore, inserts. and when i try to do this Code:
cmd = new OleDbCommand("UPDATE BigramChar SET bigram_broj = bigram_broj + 1213, bigram_txt = bigram_txt + 123123 where ID = @ID", conn);
query update successful bigram_broj and bigram_txt so when i put numbers he updates, BUT when i try @"value" it does not want to update fields yes on update query pretends to update but never changes anything in the database... |
|
#21
|
||||
|
||||
|
The only thing I can think of is maybe one of the values you're passing as a parameter isn't what it needs to be.
Try doing this and see what the results are: Code:
cmd.Parameters.AddWithValue("@ID", NgramID);
cmd.Parameters.AddWithValue("@JezikID", JezikID);
cmd.Parameters.AddWithValue("@bigram_broj", ngram.Count);
cmd.Parameters.AddWithValue("@bigram_txt", BrojZnakova);
Response.write("NgramID: " & ngramID & ", JezikID: " & JezikID & ", NgramCount: " & ngram.Count & ", bigram_txt: " & BrojZnakova)
'cmd.ExecuteNonQuery();
That way we can see what values it's actually trying to update with. |
|
#22
|
|||
|
|||
|
response.write cannot be there. error is
and "&" cannot be between string and int ![]() do you have any opinion? |
|
#23
|
||||
|
||||
|
Quote:
![]() |
|
#24
|
||||
|
||||
|
Quote:
Code:
Response.write("NgramID- " & ngramID & ", JezikID- " & JezikID & ", NgramCount- " & ngram.Count & ", bigram_txt- " & BrojZnakova)
|
|
#25
|
|||
|
|||
|
im at work now, but visual studio says that response.write cannot be written in that context or something like that.
ill check when i come home but the most annoying thing is that debugger shows all values, and no null's or errors or strings when i expect int |
|
#26
|
||||
|
||||
|
Hmmm, then just run the page and see what response.write statement outputs.
I feel, there is something that we are missing here. |
|
#27
|
|||
|
|||
|
i will and result will post here
|
|
#28
|
||||
|
||||
|
Quote:
Ahhh, when I wrote that I forgot you were using C# not vb.... replace the &'s with +'s and try again. |
|
#29
|
|||
|
|||
|
here is output
Code:
System.Diagnostics.Debug.WriteLine("NgramID- " + NgramID + ", JezikID- " + JezikID + ", NgramCount- " + ngram.Count + ", bigram_txt- " + BrojZnakova);
Quote:
all values are fine to me! and when i insert "ja sam ja" he changes value and everything looks good! only i changed update statement just to check how he work with @ID and it works great! |
|
#30
|
||||
|
||||
|
What kind of output is that??
You dont see the variable's values in those. |
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > VBScript - Database - General - Update wont work |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|