Click here to Skip to main content
15,897,704 members
Home / Discussions / Database
   

Database

 
GeneralRe: How can I use @param in a select*where... Pin
Member 138216011-Jul-05 16:58
Member 138216011-Jul-05 16:58 
GeneralRe: How can I use @param in a select*where... Pin
Yulianto.11-Jul-05 17:01
Yulianto.11-Jul-05 17:01 
GeneralRe: How can I use @param in a select*where... Pin
Member 138216011-Jul-05 17:15
Member 138216011-Jul-05 17:15 
GeneralRe: How can I use @param in a select*where... Pin
Yulianto.11-Jul-05 17:19
Yulianto.11-Jul-05 17:19 
GeneralRe: How can I use @param in a select*where... Pin
Edbert P11-Jul-05 17:09
Edbert P11-Jul-05 17:09 
GeneralRe: How can I use @param in a select*where... Pin
Member 138216011-Jul-05 17:16
Member 138216011-Jul-05 17:16 
AnswerRe: How can I use @param in a select*where... Pin
Rob Graham16-Jul-05 12:44
Rob Graham16-Jul-05 12:44 
GeneralSQL DTS Pin
vrkanth11-Jul-05 14:21
vrkanth11-Jul-05 14:21 
GeneralODBC Dialog Pin
Jmuwanga11-Jul-05 1:08
sussJmuwanga11-Jul-05 1:08 
GeneralURGENT:- ODBC connection string problem to access a remote SQL server Pin
Zalak10-Jul-05 20:02
Zalak10-Jul-05 20:02 
GeneralRe: URGENT:- ODBC connection string problem to access a remote SQL server Pin
Albert Pascual11-Jul-05 9:17
sitebuilderAlbert Pascual11-Jul-05 9:17 
GeneralXML Output spread over multiple rows Pin
totig10-Jul-05 19:41
totig10-Jul-05 19:41 
GeneralSqlDmo Pin
mahakhalid10-Jul-05 0:16
mahakhalid10-Jul-05 0:16 
GeneralRe: SqlDmo Pin
Mbat11-Jul-05 3:31
Mbat11-Jul-05 3:31 
Generalsql query Pin
Anonymous9-Jul-05 21:29
Anonymous9-Jul-05 21:29 
GeneralRe: sql query Pin
Colin Angus Mackay9-Jul-05 21:34
Colin Angus Mackay9-Jul-05 21:34 
GeneralDatabase project deployment advice Pin
Kunal Chaudhary9-Jul-05 9:08
Kunal Chaudhary9-Jul-05 9:08 
GeneralRe: Database project deployment advice Pin
Anonymous9-Jul-05 23:30
Anonymous9-Jul-05 23:30 
QuestionHow to check on Column value Pin
gharryh9-Jul-05 5:42
gharryh9-Jul-05 5:42 
GeneralInsert, Update and Delete Problem. Need Help. Thanks. Pin
shapper8-Jul-05 7:34
shapper8-Jul-05 7:34 
GeneralRe: Insert, Update and Delete Problem. Need Help. Thanks. Pin
Rob Graham8-Jul-05 8:08
Rob Graham8-Jul-05 8:08 
GeneralRe: Insert, Update and Delete Problem. Need Help. Thanks. Pin
shapper8-Jul-05 12:16
shapper8-Jul-05 12:16 
Hi,

I did that:

' Set Query and Command
Dim queryString As String = "UPDATE [t_news] SET [news_id]=@news_id_update, [title_pt-PT]=@title_ptPT, [title_en-GB]=@title_enGB, [text_pt-PT]=@text_ptPT, [text_en-GB]=@text_enGB, [publication_date]=@publication_date WHERE ([t_news].[news_id] = @news_id)"
...
' Add Parameters
With dbCommand.Parameters
.Add(New OleDbParameter("@news_id_update", 5))
.Add(New OleDbParameter("@news_id", 5))
.Add(New OleDbParameter("@title_ptPT", "Test UPDATE - title PT"))
.Add(New OleDbParameter("@title_enGB", "Test UPDATE - title EN"))
.Add(New OleDbParameter("@text_ptPT", "Test UPDATE - text PT"))
.Add(New OleDbParameter("@text_enGB", "Test UPDATE - text EN"))
.Add(New OleDbParameter("@publication_date", DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss")))
End With

I get the error: "Cannot update 'news_id'; field not updateable."

Remember that news_id is the primary key on my Access database and set as "AutoNumber"

Then I tried the following query as i don't need to change the news_id field:
Dim queryString As String = "UPDATE [t_news] SET [title_pt-PT]=@title_ptPT, [title_en-GB]=@title_enGB, [text_pt-PT]=@text_ptPT, [text_en-GB]=@text_enGB, [publication_date]=@publication_date WHERE ([t_news].[news_id] = @news_id)"

I don't get any error but there is no change in data!!!! And record 5 is there!

I even placed a Response.Write("Done") in the code:

' Update Record
dbConnection.Open()
Try
dbCommand.ExecuteNonQuery()
Finally
dbConnection.Close()
Response.Write("Done")
End Try

And it is displayed "DONE"!

My INSERT and DELETE codes are working fine.

What is going on with this UPDATE code?

Thanks,
Miguel
GeneralRe: Insert, Update and Delete Problem. Need Help. Thanks. Pin
Rob Graham8-Jul-05 17:16
Rob Graham8-Jul-05 17:16 
GeneralRe: Insert, Update and Delete Problem. Need Help. Thanks. Pin
jjrdk8-Jul-05 10:18
jjrdk8-Jul-05 10:18 
GeneralRe: Insert, Update and Delete Problem. Need Help. Thanks. Pin
Luis Alonso Ramos9-Jul-05 23:26
Luis Alonso Ramos9-Jul-05 23:26 

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.