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

C#

 
QuestionRegular Expression Pin
yadlaprasad19-Mar-09 20:11
yadlaprasad19-Mar-09 20:11 
AnswerRe: Regular Expression Pin
Mycroft Holmes19-Mar-09 20:24
professionalMycroft Holmes19-Mar-09 20:24 
AnswerRe: Regular Expression Pin
Christian Graus19-Mar-09 21:08
protectorChristian Graus19-Mar-09 21:08 
AnswerRe: Regular Expression Pin
Deresen19-Mar-09 23:55
Deresen19-Mar-09 23:55 
Questionhow i get file name string Pin
Mangesh Tomar19-Mar-09 20:03
Mangesh Tomar19-Mar-09 20:03 
AnswerRe: how i get file name string Pin
N a v a n e e t h19-Mar-09 20:05
N a v a n e e t h19-Mar-09 20:05 
AnswerRe: how i get file name string Pin
Deresen19-Mar-09 23:54
Deresen19-Mar-09 23:54 
Questionpivote table logic Pin
Mangesh Tomar19-Mar-09 19:18
Mangesh Tomar19-Mar-09 19:18 
Hi here is my code i conver the excel file in to sql server 2005 i want to write a logc for excel data to cerate a pivot table for specific coloumbs
I want help regarding the SQL query


namespace WindowsApplication2
{ public partial class Form1 : Form
{
DataTable dtbl;
private SqlCommand scmd;
public Form1()
{
InitializeComponent();
scmd = new SqlCommand();
}
private void button1_Click(object sender, EventArgs e)
{
string filename = @"C:\abc.xls";
String connectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + filename + ";" +
"Extended Properties=Excel 8.0;";
OleDbConnection connection = new OleDbConnection(connectionString);
connection.Open();
OleDbCommand selectCommand = new OleDbCommand("SELECT * FROM [sheet1$]", connection);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter();
dataAdapter.SelectCommand = selectCommand;
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet);
dtaTable dataTable = dataSet.Tables[0];
dataGridView1.DataSource = dataSet.Tables[0];
MessageBox.Show(dataGridView1.RowCount.ToString());
connection.Close();
}
private void Form1_Load(object sender, EventArgs e)
{
string constr = "server=Myserver,database=mor,uid=;pwd=;";
SqlConnection sqcon = new SqlConnection(constr);
string cnd = "Select * from emp";
}
private void button2_Click(object sender, EventArgs e)
{
string constr="data source=Myserver;initial catalog=mo;integrated security=SSPI";
SqlConnection sqcon = new SqlConnection(constr);
sqcon.Open();
int i = 1;
while (i < (dataGridView1.Rows.Count)-2)
{
string istr = "insert into emp(name,std,des)values('" + Convert.ToString(dataGridView1.Rows[i].Cells[9].Value.ToString()) + "','" + Convert.ToString(dataGridView1.Rows[i].Cells[10].Value.ToString()) + "','" +Convert.ToString(dataGridView1.Rows[i].Cells[17].Value.ToString()) + "')";
scmd.CommandText = istr;
scmd.Connection = sqcon;
int r;
r = scmd.ExecuteNonQuery();
i++;
}
if (i > 1)
{
MessageBox.Show("Records saved");
}

}}}
AnswerRe: pivote table logic Pin
Mycroft Holmes19-Mar-09 20:21
professionalMycroft Holmes19-Mar-09 20:21 
Questiononly open excel file Pin
Mangesh Tomar19-Mar-09 18:37
Mangesh Tomar19-Mar-09 18:37 
AnswerRe: only open excel file Pin
Sunil Lanke19-Mar-09 18:57
Sunil Lanke19-Mar-09 18:57 
GeneralRe: only open excel file Pin
Mangesh Tomar19-Mar-09 19:45
Mangesh Tomar19-Mar-09 19:45 
GeneralRe: only open excel file Pin
Christian Graus19-Mar-09 20:07
protectorChristian Graus19-Mar-09 20:07 
QuestionHow to config the strong name for Wrapper Assembly key file in project properties.Could you please show me the steps? thanks Pin
Garyxiao91319-Mar-09 16:44
Garyxiao91319-Mar-09 16:44 
QuestionCreateObject and OLE Automation Server in C# Pin
User 1278219-Mar-09 16:43
User 1278219-Mar-09 16:43 
AnswerRe: CreateObject and OLE Automation Server in C# Pin
Fayu20-Mar-09 5:47
Fayu20-Mar-09 5:47 
GeneralRe: CreateObject and OLE Automation Server in C# Pin
User 1278222-Mar-09 17:28
User 1278222-Mar-09 17:28 
GeneralRe: CreateObject and OLE Automation Server in C# Pin
joejoe2k27-Sep-11 10:32
joejoe2k27-Sep-11 10:32 
GeneralRe: CreateObject and OLE Automation Server in C# Pin
User 1278227-Sep-11 15:50
User 1278227-Sep-11 15:50 
Questionhow can you check build/debug version during runtime? Pin
devvvy19-Mar-09 15:51
devvvy19-Mar-09 15:51 
AnswerRe: how can you check build/debug version during runtime? Pin
Christian Graus19-Mar-09 15:55
protectorChristian Graus19-Mar-09 15:55 
AnswerRe: how can you check build/debug version during runtime? Pin
Yusuf19-Mar-09 15:59
Yusuf19-Mar-09 15:59 
GeneralRe: how can you check build/debug version during runtime? Pin
devvvy19-Mar-09 16:20
devvvy19-Mar-09 16:20 
QuestionCan C# 2005 pro edition work with windows vista home basic? Pin
RogerLum19-Mar-09 15:46
RogerLum19-Mar-09 15:46 
AnswerRe: Can C# 2005 pro edition work with windows vista home basic? Pin
Christian Graus19-Mar-09 15:58
protectorChristian Graus19-Mar-09 15:58 

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.