Click here to Skip to main content
15,887,596 members
Home / Discussions / Database
   

Database

 
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 
GeneralSQL Server; Recursive Functions and Scope. (Long-ish post) Pin
Alsvha8-Jul-05 3:45
Alsvha8-Jul-05 3:45 
Generalopening documents without saving to disk Pin
carabrenna8-Jul-05 0:26
carabrenna8-Jul-05 0:26 
GeneralRe: opening documents without saving to disk Pin
Colin Angus Mackay8-Jul-05 3:13
Colin Angus Mackay8-Jul-05 3:13 
GeneralRe: opening documents without saving to disk Pin
Anonymous8-Jul-05 10:29
Anonymous8-Jul-05 10:29 
GeneralSQL vs. Access and ODBC Pin
-- NA --7-Jul-05 21:17
-- NA --7-Jul-05 21:17 
GeneralRe: SQL vs. Access and ODBC Pin
RajithCAlwis7-Jul-05 21:45
RajithCAlwis7-Jul-05 21:45 
GeneralRe: SQL vs. Access and ODBC Pin
-- NA --8-Jul-05 22:25
-- NA --8-Jul-05 22:25 
GeneralRe: SQL vs. Access and ODBC Pin
Anonymous9-Jul-05 7:41
Anonymous9-Jul-05 7:41 
GeneralRe: SQL vs. Access and ODBC Pin
-- NA --9-Jul-05 12:51
-- NA --9-Jul-05 12:51 
GeneralRe: SQL vs. Access and ODBC Pin
-- NA --9-Jul-05 12:50
-- NA --9-Jul-05 12:50 
GeneralDataset Pin
skrishnasarma7-Jul-05 18:07
skrishnasarma7-Jul-05 18:07 
GeneralRe: Dataset Pin
Christian Graus7-Jul-05 18:56
protectorChristian Graus7-Jul-05 18:56 
Generalsql 2005 installation Pin
Anonymous7-Jul-05 17:02
Anonymous7-Jul-05 17:02 
GeneralPrinting Reports Pin
OMalleyW7-Jul-05 8:00
OMalleyW7-Jul-05 8:00 

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.