473,320 Members | 2,035 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

problem access insert instruction

i don't know what to do really i've seen the code 100 times and it seem right
so if anyone can help....this's the code

public void ajout_dossier_image(string dossier,string matr)
{

if (Directory.Exists(dossier))
{ try
{
scanDirectory(dossier, "*.jpg", System.IO.SearchOption.
TopDirectoryOnly);
String selectedImage = selectedImg;
if (imgList == null)
return;
foreach (String img in imgList) {ajout_image_seul(img,
matr);}
}
catch (Exception exe) { MessageBox.Show("erreur du dossier de
l'image");}
}
}
public void ajout_image_seul(string nom_img,string matr)
{
try
{
string date = "01/01/2005";//Convert.ToString(DateTime.Now)
string conStr = @"Provider=Microsoft.JET.OLEDB.4.0;" + @"data
source=DermatoSoft_DB.mdb";
dataGridView1.DataSource = null;
ds = new DataSet();
conn = new OleDbConnection(conStr);
command = conn.CreateCommand();
conn.Open();
command.CommandText = "INSERT INTO Image (Numero_Patients,
Nom_Image,Date_Image,"
+"Commentaire_Image) VALUES (" + matr + ",'" + nom_img +
"','" + date + "','exemple commentaire')";
adapter = new OleDbDataAdapter(command);
adapter.Fill(ds);
conn.Close();
}
catch (Exception exe)
{
MessageBox.Show("erreur dans l'ajout de l'image");
}
}

thanks

--
Message posted via http://www.dotnetmonster.com

Jun 12 '07 #1
1 1840
Try this :
public void ajout_image_seul(string nom_img,string matr)
{
try
{
string date = "01/01/2005";//
Convert.ToString(DateTime.Now)
string conStr = @"Provider=Microsoft.JET.OLEDB.4.0;" +
@"data
source=DermatoSoft_DB.mdb";
dataGridView1.DataSource = null;
ds = new DataSet();
conn = new OleDbConnection(conStr);
command.Connection = conn;

command.CommandText = "INSERT INTO Image
(Numero_Patients,
Nom_Image,Date_Image,"
+"Commentaire_Image) VALUES (" + matr + ",'" +
nom_img +
"','" + date + "','exemple commentaire')";
conn.Open();
int rowsAffected = command.ExecuteNonQuery();//must be
1
conn.Close();
}
catch (Exception exe)
{
MessageBox.Show("erreur dans l'ajout de l'image");
}
}
Jun 12 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Helene Pinol | last post by:
Dear All I have a problem to insert elements in a combination of containers. Here is the declaration of the container I would like to use: vector< set<myElement> >...
3
by: RobertG | last post by:
Hello I have 2 databases on PostgreSQL, for instance base1, base2. I connect to psql: psql -p 3333 base1 how can I access to base2 ? for instance I wont do instruction: insert into test(a, b)...
1
by: windandwaves | last post by:
Are you allowed to use the following syntax in Mysql 4.0.17-nt : INSERT DELAYED IGNORE INTO `mytable` ( `ID` , `A` , `B` ) VALUES ("'.session_id().'", "2", ROUND(NOW()/10000) ); I am...
6
by: Fredrik Nelson | last post by:
Hi, I have used xsl to transform xml from sqlserver in and it works fine now i have a webservice that uses a dataset to get the data and return it as xml like the code below <WebMethod()> _...
2
by: valerio | last post by:
Hi all, I've some problem to import data to DB2 using the db2move and db2look tools. Follow the problem : I have exported data from db2 v. 7 database on windows server, using the db2look and...
10
by: Michel | last post by:
Hi, We are from Belgium and are looking for someone who could write us a point-of-sale (POS) software for a DVD-film shop. I like it to be in MS-Access with some VBA or just VB. The...
3
by: John Marble | last post by:
I am quite new with Access, so please be indulgent if my question sound a little bit newbish. I have two table in the same database: DOSSIER and MAIN. MAIN is having already formatted data...
7
by: Mark Denardo | last post by:
Hi I have a TabControl object that I need to insert new TabPages into. To append them to the end of the Controls Collection I can do: tc.controls.add(tp) (tc - tabcontrol object) (tp -...
23
by: Gloops | last post by:
Hello everybody, Is anyone able to give me some indications about how to develop an Access interface for an Oracle database ? I dispose of Access 2003 (11.6566.8107) SP2, Oracle 9i 9.2.0.1.0...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.