TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Israel
702
1.3k
215.8k
droping a column table in simples codes
Apr 11 2018 10:38 PM
Hi,
I need to do two things with my table:
1. create (or add) a column in my table
2. delete (or drope) a column from my table
All this using c# code.
I do write theses codes to create a ID primary key for example and its works perfetly:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\FlexitFAA\Datas\faa.mdb;Persist Security Info=False");
OleDbCommand comm;
private void button1_Click(object sender, EventArgs e)
{
conn.Open();
OleDbCommand cmd2 = new OleDbCommand();
cmd2 = new OleDbCommand("ALTER TABLE Test ADD " + textBox1.Text + " int IDENTITY(1,1) PRIMARY KEY)", conn);
cmd2.ExecuteNonQuery();
conn.Close();
}
Now I need to do the second thing. I want to delete (or drop) the name of column that I will insert in my table.
Please could you help writing clearly the codes
Thank you.
Reply
Answers (
4
)
C# HttpWebRequest timing out from USA IPs, fine in browsers
Regular expression to validate date ?