Sign in to follow this  
phil05

Need help with ADO.NET

Recommended Posts

I'm reading my C# book which also teaches ADO.NET. I'm trying to get started, but it doesn't teach how to set it up. It just starts teaching it from the ground up. I put in what it teaches, but when I execute it, it says: Shared Memory Provider: The specified module could not be found.\r\n Any thoughts are welcomed.
#region Using directives

using System;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;

#endregion

namespace ADO_NET_Practice
{
    partial class FormMain : Form
    { 
        public FormMain()
        {
            InitializeComponent(); 
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string source = "server=(local)\\NetSDK;" +
                "integrated security=SSPI;" +
                "database=Northwind";
            string select = "UPDATE Customers " +
                "SET ContactName = 'Bob' " +
                "WHERE ContactName = 'Bill'";
            
            SqlConnection conn = new SqlConnection(source);

            conn.Open();

            SqlCommand cmd = new SqlCommand(select, conn);
            int rowsReturned = cmd.ExecuteNonQuery();

            MessageBox.Show(rowsReturned + " rows returned.");


            conn.Close();        
        }
    }
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this