Click here to Skip to main content
15,916,318 members
Home / Discussions / Database
   

Database

 
GeneralRe: DTS: Transform Task > Stored Procedure > Temp Table error Pin
Bjohnson3323-Oct-07 21:19
Bjohnson3323-Oct-07 21:19 
AnswerRe: DTS: Transform Task > Stored Procedure > Temp Table error [modified] Pin
GuyThiebaut23-Oct-07 10:26
professionalGuyThiebaut23-Oct-07 10:26 
GeneralRe: DTS: Transform Task > Stored Procedure > Temp Table error Pin
Bjohnson3323-Oct-07 21:21
Bjohnson3323-Oct-07 21:21 
GeneralRe: DTS: Transform Task > Stored Procedure > Temp Table error Pin
GuyThiebaut23-Oct-07 22:35
professionalGuyThiebaut23-Oct-07 22:35 
QuestionHow to reset the identity Pin
devboycpp23-Oct-07 4:56
devboycpp23-Oct-07 4:56 
AnswerRe: How to reset the identity Pin
Pete O'Hanlon23-Oct-07 5:00
mvePete O'Hanlon23-Oct-07 5:00 
AnswerRe: How to reset the identity Pin
Mitesh Darji23-Oct-07 22:52
Mitesh Darji23-Oct-07 22:52 
QuestionUpdate Query Cant seem to spot the problem Pin
ekynox23-Oct-07 2:56
ekynox23-Oct-07 2:56 
Hi there,

Well it seems I have stumbled upon a rather basic problem and I just cant seem to work it out. I have written a simple update query as follows:

<br />
private readonly string ACCESS_CUSTOMER_UPDATE = "UPDATE Customer SET Customer.Name = @Name,Customer.Age = @Age WHERE Customer.ID = @ID";<br />


I have used the approach to execute the query in the method listed below. For the life of me I cant seem to work out why the update wont be taking place. I have executed the query listed above in Access without any problems but when encapsulated in the method below it just wont update.

I'd appreciate if someone could point out the mistake I have overlooked.

Thanks


        <br />
private string PARAM_ID = "@ID";<br />
private string PARAM_NAME = "@Name";<br />
private string PARAM_AGE = "@Age";<br />
<br />
private string connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Temp\\temp.mdb";<br />
<br />
private OleDbConnection connection = new OleDbConnection(connectionstring);<br />
<br />
public void UpdateCustomer(CustomerInfo customer)<br />
{<br />
           OleDbParameter[] parameters = new OleDbParameter[]{<br />
                new OleDbParameter(PARAM_ID,OleDbType.Integer),<br />
                new OleDbParameter(PARAM_NAME,OleDbType.VarChar),<br />
                new OleDbParameter(PARAM_AGE,OleDbType.Integer)};<br />
<br />
            parameters[0].Value = customer.ID;<br />
            parameters[1].Value = customer.Name;<br />
            parameters[2].Value = customer.Age;<br />
<br />
            OleDbCommand command = new OleDbCommand();<br />
            command.Connection = this.connection;<br />
            command.Connection.Open();<br />
            command.CommandText = "UPDATE Customer SET Customer.Name = @Name,Customer.Age = @Age WHERE Customer.ID = @ID";<br />
<br />
            for (int i = 0; i < parameters.Length; i++)<br />
            {<br />
                OleDbParameter parm = (OleDbParameter)parameters[i];<br />
                command.Parameters.Add(parm);<br />
            }<br />
<br />
            try<br />
            {<br />
                int x = command.ExecuteNonQuery();<br />
                Debug.WriteLine(x.ToString());<br />
            }<br />
            catch (Exception e)<br />
            {<br />
                throw new Exception(e.Message, e.InnerException);<br />
            }<br />
            finally<br />
            {<br />
                command.Connection.Close();<br />
                command.Dispose();<br />
            }<br />
}<br />


edit:
Added the connection string.
AnswerRe: Update Query Cant seem to spot the problem Pin
squattyarun23-Oct-07 3:05
squattyarun23-Oct-07 3:05 
AnswerRe: Update Query Cant seem to spot the problem Pin
Paddy Boyd23-Oct-07 3:06
Paddy Boyd23-Oct-07 3:06 
GeneralRe: Update Query Cant seem to spot the problem Pin
ekynox23-Oct-07 3:20
ekynox23-Oct-07 3:20 
GeneralRe: Update Query Cant seem to spot the problem Pin
Paddy Boyd23-Oct-07 3:43
Paddy Boyd23-Oct-07 3:43 
AnswerRe: Update Query Cant seem to spot the problem Pin
Rob Graham23-Oct-07 7:53
Rob Graham23-Oct-07 7:53 
GeneralRe: Update Query Cant seem to spot the problem Pin
ekynox23-Oct-07 10:32
ekynox23-Oct-07 10:32 
QuestionDelete Pin
ritu432123-Oct-07 1:35
ritu432123-Oct-07 1:35 
AnswerRe: Delete Pin
sindhutiwari23-Oct-07 1:41
sindhutiwari23-Oct-07 1:41 
GeneralRe: Delete Pin
pmarfleet23-Oct-07 1:48
pmarfleet23-Oct-07 1:48 
AnswerRe: Delete Pin
pmarfleet23-Oct-07 1:43
pmarfleet23-Oct-07 1:43 
AnswerRe: Delete Pin
N a v a n e e t h23-Oct-07 1:57
N a v a n e e t h23-Oct-07 1:57 
GeneralRe: Delete Pin
ritu432123-Oct-07 2:11
ritu432123-Oct-07 2:11 
GeneralRe: Delete Pin
N a v a n e e t h23-Oct-07 2:14
N a v a n e e t h23-Oct-07 2:14 
GeneralRe: Delete Pin
sindhutiwari23-Oct-07 2:22
sindhutiwari23-Oct-07 2:22 
GeneralRe: Delete Pin
pmarfleet23-Oct-07 3:19
pmarfleet23-Oct-07 3:19 
AnswerRe: Delete Pin
Krish - KP23-Oct-07 2:19
Krish - KP23-Oct-07 2:19 
Questionstoring image in access database Pin
sindhutiwari23-Oct-07 1:21
sindhutiwari23-Oct-07 1:21 

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.