Click here to Skip to main content
15,888,005 members
Home / Discussions / C#
   

C#

 
Questiondata from excel file Pin
Member 59031027-Jul-09 20:36
Member 59031027-Jul-09 20:36 
AnswerRe: data from excel file Pin
Tamer Oz27-Jul-09 20:45
Tamer Oz27-Jul-09 20:45 
GeneralRe: data from excel file Pin
Member 59031027-Jul-09 20:48
Member 59031027-Jul-09 20:48 
GeneralRe: data from excel file Pin
Tamer Oz27-Jul-09 21:31
Tamer Oz27-Jul-09 21:31 
GeneralRe: data from excel file Pin
Member 59031027-Jul-09 23:25
Member 59031027-Jul-09 23:25 
Questionc# Serialisation Exception Pin
GauravKP27-Jul-09 20:32
professionalGauravKP27-Jul-09 20:32 
QuestionStore multiple items from listbox to database Pin
elci27-Jul-09 20:26
elci27-Jul-09 20:26 
AnswerRe: Store multiple items from listbox to database Pin
Blikkies27-Jul-09 22:47
professionalBlikkies27-Jul-09 22:47 
Here is a peace of code, did not test it but it sould work:

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

namespace test
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();

//
// TODO: Add constructor code after the InitializeComponent() call.
//
}

void Button1Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(@"User ID=username; Password=pass; Initial Catalog=databasename; data source=localhost");
SqlCommand cmd = conn.CreateCommand();
foreach(object i in listBox1.SelectedItems)
{
cmd.CommandText = "INSERT INTO TableName (columnName) VALUES('"+i.ToString()+"')";
cmd.ExecuteNonQuery();
}
conn.Close();

}
}
}
QuestionAccesing remote files Pin
Kushi Bobby27-Jul-09 20:16
Kushi Bobby27-Jul-09 20:16 
AnswerRe: Accesing remote files Pin
Tamer Oz27-Jul-09 20:49
Tamer Oz27-Jul-09 20:49 
GeneralRe: Accesing remote files Pin
Kushi Bobby27-Jul-09 21:16
Kushi Bobby27-Jul-09 21:16 
GeneralRe: Accesing remote files Pin
Tamer Oz27-Jul-09 21:34
Tamer Oz27-Jul-09 21:34 
GeneralRe: Accesing remote files Pin
Kushi Bobby27-Jul-09 21:44
Kushi Bobby27-Jul-09 21:44 
GeneralRe: Accesing remote files Pin
Tamer Oz28-Jul-09 1:01
Tamer Oz28-Jul-09 1:01 
GeneralRe: Accesing remote files Pin
Kushi Bobby28-Jul-09 15:25
Kushi Bobby28-Jul-09 15:25 
QuestionError.. Pin
mjawadkhatri27-Jul-09 20:15
mjawadkhatri27-Jul-09 20:15 
AnswerRe: Error.. Pin
Christian Graus27-Jul-09 20:26
protectorChristian Graus27-Jul-09 20:26 
GeneralRe: Error.. Pin
mjawadkhatri27-Jul-09 20:32
mjawadkhatri27-Jul-09 20:32 
GeneralRe: Error.. Pin
Mbah Dhaim27-Jul-09 20:52
Mbah Dhaim27-Jul-09 20:52 
GeneralRe: Error.. Pin
mjawadkhatri27-Jul-09 21:00
mjawadkhatri27-Jul-09 21:00 
GeneralRe: Error.. Pin
Mbah Dhaim27-Jul-09 21:09
Mbah Dhaim27-Jul-09 21:09 
AnswerRe: Error.. Pin
riced27-Jul-09 20:30
riced27-Jul-09 20:30 
GeneralRe: Error.. Pin
mjawadkhatri27-Jul-09 20:36
mjawadkhatri27-Jul-09 20:36 
GeneralRe: Error.. Pin
Christian Graus27-Jul-09 21:01
protectorChristian Graus27-Jul-09 21:01 
AnswerRe: Error.. Pin
Blikkies27-Jul-09 23:09
professionalBlikkies27-Jul-09 23:09 

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.