Click here to Skip to main content
15,891,423 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to stop downloading progress in WebClient? Pin
Eddy Vluggen30-Apr-12 5:55
professionalEddy Vluggen30-Apr-12 5:55 
GeneralRe: How to stop downloading progress in WebClient? Pin
amx_tiger30-Apr-12 6:09
amx_tiger30-Apr-12 6:09 
QuestionRe: How to stop downloading progress in WebClient? Pin
Eddy Vluggen30-Apr-12 6:16
professionalEddy Vluggen30-Apr-12 6:16 
AnswerRe: How to stop downloading progress in WebClient? Pin
amx_tiger30-Apr-12 6:35
amx_tiger30-Apr-12 6:35 
GeneralRe: How to stop downloading progress in WebClient? Pin
Eddy Vluggen30-Apr-12 7:02
professionalEddy Vluggen30-Apr-12 7:02 
GeneralRe: How to stop downloading progress in WebClient? Pin
amx_tiger30-Apr-12 22:19
amx_tiger30-Apr-12 22:19 
GeneralRe: How to stop downloading progress in WebClient? Pin
Eddy Vluggen1-May-12 1:02
professionalEddy Vluggen1-May-12 1:02 
QuestionInserting a row into an Access Database with C# Pin
Premisoft29-Apr-12 20:00
Premisoft29-Apr-12 20:00 
I have wrote C# programs similar to the one that I am working on right now time and time again, but on this particular occasion, I am having issues in making my code insert values into an Access Database. BTW, I am using Visual Studio 2010 and .net 4. Maybe it is something with .net 4...... Anyway, this is my code


C#
private void btnAddRecord_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            string connstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Steinar.accdb";
            OleDbConnection conn = new OleDbConnection(connstr);
            da.InsertCommand = conn.CreateCommand();
            da.InsertCommand.CommandText = "INSERT INTO Returns" +
                "(DateReceived, Dealer, Department, CustomerName, Address, Zip, City, Email, Phone)" +
                "VALUES(@DateReceived, @Dealer, @Department, @CustomerName, @Address, @Zip, @City, @Email, @Phone)";

               AddParams(da.InsertCommand, "DateReceived", "Dealer", "Department", "CustomerName", "Address", "Zip", "City", "Email", "Phone");
                DataRow row = dt.NewRow();
                dt.Rows.Add(row);
                totalRecord = dt.Rows.Count;
                currRecord = totalRecord - 1;

            
            
            this.Cursor = Cursors.Default;
          

        }

        private void AddParams(OleDbCommand cmd, params string[] cols)
        {
            foreach (string col in cols)
                cmd.Parameters.Add("@" + col, OleDbType.Char, 0, col);
        }




I have set breakpoints and the AddParams method never executes... I can't figure out why it doesn't but it doesn't.
Can anyone see what I have wrong in this code? I am declaring all of my globals inside the class declaration

C#
private OleDbDataAdapter da = new OleDbDataAdapter();
        private OleDbConnection conn = new OleDbConnection();
        private DataTable dt = new DataTable();
        private DataSet ds = new DataSet();
        int currRecord = 0;
        int totalRecord = 0;


Any help would be greatly appreciated.
AnswerRe: Inserting a row into an Access Database with C# Pin
OriginalGriff29-Apr-12 22:05
mveOriginalGriff29-Apr-12 22:05 
GeneralRe: Inserting a row into an Access Database with C# Pin
Premisoft30-Apr-12 3:48
Premisoft30-Apr-12 3:48 
GeneralRe: Inserting a row into an Access Database with C# Pin
Wes Aday30-Apr-12 5:23
professionalWes Aday30-Apr-12 5:23 
QuestionWinmm.dll for CF Windows CE Pin
baranils29-Apr-12 11:30
baranils29-Apr-12 11:30 
QuestionCollision detection between a circle and rectangle Pin
lethula29-Apr-12 5:46
lethula29-Apr-12 5:46 
AnswerRe: Collision detection between a circle and rectangle Pin
Abhinav S29-Apr-12 16:36
Abhinav S29-Apr-12 16:36 
GeneralRe: Collision detection between a circle and rectangle Pin
lethula30-Apr-12 13:20
lethula30-Apr-12 13:20 
AnswerRe: Collision detection between a circle and rectangle Pin
BobJanova29-Apr-12 23:18
BobJanova29-Apr-12 23:18 
GeneralRe: Collision detection between a circle and rectangle Pin
lethula30-Apr-12 13:27
lethula30-Apr-12 13:27 
GeneralRe: Collision detection between a circle and rectangle Pin
BobJanova30-Apr-12 22:19
BobJanova30-Apr-12 22:19 
GeneralRe: Collision detection between a circle and rectangle Pin
lethula1-May-12 22:17
lethula1-May-12 22:17 
GeneralRe: Collision detection between a circle and rectangle Pin
BobJanova2-May-12 0:46
BobJanova2-May-12 0:46 
GeneralRe: Collision detection between a circle and rectangle Pin
lethula2-May-12 8:36
lethula2-May-12 8:36 
GeneralRe: Collision detection between a circle and rectangle Pin
BobJanova3-May-12 0:30
BobJanova3-May-12 0:30 
QuestionHow to get video frames from usb cam buffer Pin
bunyamin_28-Apr-12 22:58
bunyamin_28-Apr-12 22:58 
Questionhow to Encrypting Class Library Pin
jojoba201128-Apr-12 17:55
jojoba201128-Apr-12 17:55 
AnswerRe: how to Encrypting Class Library Pin
Richard MacCutchan28-Apr-12 21:28
mveRichard MacCutchan28-Apr-12 21:28 

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.