Click here to Skip to main content
15,887,356 members
Home / Discussions / C#
   

C#

 
AnswerRe: responsive GUI text change / database instant search Pin
Richard Deeming4-Jul-14 6:13
mveRichard Deeming4-Jul-14 6:13 
Answerfeedback: responsive GUI text change / database instant search Pin
Member 817404-Jul-14 8:27
Member 817404-Jul-14 8:27 
QuestionMessage Closed Pin
4-Jul-14 0:51
Mehtech4-Jul-14 0:51 
AnswerMessage Removed Pin
4-Jul-14 1:36
mvePete O'Hanlon4-Jul-14 1:36 
GeneralMessage Removed Pin
4-Jul-14 1:47
mveRichard Deeming4-Jul-14 1:47 
AnswerMessage Removed Pin
4-Jul-14 14:55
Jesus Daniel 20134-Jul-14 14:55 
GeneralMessage Removed Pin
5-Jul-14 0:49
professionalEddy Vluggen5-Jul-14 0:49 
Questionhow to solve this.... Pin
Nishant.Chauhan803-Jul-14 23:56
Nishant.Chauhan803-Jul-14 23:56 
i want to add new column in my database table like unique id (primary key ) when import excel file to a table then automatic generate new add column to a table (unique id ) following code:-

protected void btnUpload_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string path = string.Concat((Server.MapPath("~/Data/" + FileUpload1.FileName)));
FileUpload1.PostedFile.SaveAs(path);
OleDbConnection OleDbcon = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;");

OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Sheet3$]", OleDbcon);
OleDbDataAdapter objAdapter1 = new OleDbDataAdapter(cmd);

OleDbcon.Open();
DbDataReader dr = cmd.ExecuteReader();

string con_str = @"Data Source=vaio\sqlexpress;Initial Catalog=dbemp;Integrated Security=True";

// Bulk Copy to SQL Server
SqlBulkCopy bulkInsert = new SqlBulkCopy(con_str);
bulkInsert.DestinationTableName = "tbdata";
bulkInsert.WriteToServer(dr);
OleDbcon.Close();
Array.ForEach(Directory.GetFiles((Server.MapPath("~/Data/"))), File.Delete);
Label1.ForeColor = Color.Green;
Label1.Text = "successfully inserted";
FetchData();
newrow();

}
else
{
Label1.ForeColor = Color.Red;
Label1.Text = "Please select the File";
}
}
public void FetchData()
{
SqlConnection con = new SqlConnection(@"Data Source=vaio\sqlexpress;Initial Catalog=dbemp;Integrated Security=True");
SqlCommand cmd = new SqlCommand("select * from tbdata", con);
con.Open();
SqlDataReader rdr = cmd.ExecuteReader();
GridView1.DataSource = rdr;
GridView1.DataBind();

}
public void newrow()
{
SqlConnection con;
SqlDataAdapter dladpt;
DataSet dldst;
DataTable mydt;

con = new SqlConnection(@"Data Source=vaio\sqlexpress;Initial Catalog=dbemp;Integrated Security=True");
dladpt = new SqlDataAdapter("select * from tbdata", con);
dldst = new DataSet();
mydt = new DataTable();
dladpt.Fill(mydt);

DataColumn dcolColumn = new DataColumn("Link", typeof(string));
mydt.Columns.Add(dcolColumn);

DataRow drowItem;

foreach (DataRow row in mydt.Columns)
{
drowItem = mydt.NewRow();
drowItem["Link"] = "secret";
mydt.Rows.Add(drowItem);
}
GridView1.DataSource = mydt;
GridView1.DataBind();
}
}
AnswerRe: how to solve this.... Pin
Eddy Vluggen4-Jul-14 6:21
professionalEddy Vluggen4-Jul-14 6:21 
Questionaccess textbox in a tabPage Pin
Papatrexas3-Jul-14 23:37
Papatrexas3-Jul-14 23:37 
AnswerRe: access textbox in a tabPage Pin
OriginalGriff3-Jul-14 23:52
mveOriginalGriff3-Jul-14 23:52 
Questionc# ListView header text word wrap option Pin
Galym3-Jul-14 18:28
professionalGalym3-Jul-14 18:28 
AnswerRe: c# ListView header text word wrap option Pin
Pete O'Hanlon4-Jul-14 1:48
mvePete O'Hanlon4-Jul-14 1:48 
GeneralRe: c# ListView header text word wrap option Pin
Galym4-Jul-14 17:39
professionalGalym4-Jul-14 17:39 
Questionhow to scan file on virustotal Pin
Member 105796733-Jul-14 17:42
Member 105796733-Jul-14 17:42 
AnswerRe: how to scan file on virustotal Pin
Richard MacCutchan4-Jul-14 0:49
mveRichard MacCutchan4-Jul-14 0:49 
Questionaccessing public static member of one class in another class Pin
KRISHNARAYALU3-Jul-14 11:59
KRISHNARAYALU3-Jul-14 11:59 
AnswerRe: accessing public static member of one class in another class Pin
Matt T Heffron3-Jul-14 12:32
professionalMatt T Heffron3-Jul-14 12:32 
GeneralRe: accessing public static member of one class in another class Pin
KRISHNARAYALU4-Jul-14 0:48
KRISHNARAYALU4-Jul-14 0:48 
GeneralRe: accessing public static member of one class in another class Pin
Pete O'Hanlon4-Jul-14 1:40
mvePete O'Hanlon4-Jul-14 1:40 
AnswerRe: accessing public static member of one class in another class Pin
Dave Kreskowiak3-Jul-14 18:05
mveDave Kreskowiak3-Jul-14 18:05 
AnswerRe: accessing public static member of one class in another class Pin
Richard MacCutchan4-Jul-14 0:48
mveRichard MacCutchan4-Jul-14 0:48 
Questionmoving slideshow Pin
Member 109229203-Jul-14 8:36
Member 109229203-Jul-14 8:36 
AnswerRe: moving slideshow Pin
User 48350473-Jul-14 9:22
User 48350473-Jul-14 9:22 
QuestionMongo DB Projection from C# Pin
Ennis Ray Lynch, Jr.3-Jul-14 8:22
Ennis Ray Lynch, Jr.3-Jul-14 8:22 

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.