Click here to Skip to main content
16,011,804 members
Home / Discussions / C#
   

C#

 
AnswerRe: Mapping a Drive at runtime Pin
Koushik Biswas12-Jan-06 6:07
Koushik Biswas12-Jan-06 6:07 
GeneralRe: Mapping a Drive at runtime Pin
exhaulted12-Jan-06 9:08
exhaulted12-Jan-06 9:08 
Questionproblem with datagrid.unselect Pin
melanieab12-Jan-06 2:41
melanieab12-Jan-06 2:41 
AnswerRe: problem with datagrid.unselect Pin
exhaulted12-Jan-06 3:17
exhaulted12-Jan-06 3:17 
QuestionGenerics Problem Pin
Kevin McFarlane12-Jan-06 1:41
Kevin McFarlane12-Jan-06 1:41 
AnswerRe: Generics Problem Pin
mav.northwind12-Jan-06 5:18
mav.northwind12-Jan-06 5:18 
GeneralRe: Generics Problem Pin
Kevin McFarlane12-Jan-06 7:44
Kevin McFarlane12-Jan-06 7:44 
Questionplease correct my query Pin
Sasuko12-Jan-06 1:18
Sasuko12-Jan-06 1:18 
i've a database with this structure:
[Name]* = text
[Surname]*= text
[Address]= text
[Description] = text
[Note]= memo
[Image] = OLE OBJECT
[Number] = int32

string query = "INSERT INTO TableInformation ([Name], [Surname], [Address], [Description], [Note], [Image], [Attached], [Number]) VALUES('";

conn.Open();

OleDbCommand cmd = new OleDbCommand();

// getName(), getSurname(), getAddress() return string
query += getName() + "', ";
query += getSurname() + ", '";

if(getAddress() != "")
query += "'" + getAddress() + "', ";
else
query += DBNull.Value + ", ";

// getMemo() return string
if(getMemo() != "")
query += "'" + getMemo() + "', ";
else
query += DBNull.Value + ", ";

query += "@Image, ";

// image is byte[]
if(image != null){
cmd.Parameters.Add("@Image", OleDbType.VarBinary, (int)image.Length).Value = image;
}
else
cmd.Parameters.Add("@Image", DBNull.Value);
}

if(getValue() != "")
query += "'" + getValue();
else
query += DBNull.Value;

query += ")";

cmd.Connection = conn;
cmd.CommandText = query;
cmd.ExecuteNonQuery();

the query when image is null is like this:

---------------------------

INSERT INTO TableInformation ([Name], [Surname], [Address], [Description], [Note], [Image]) VALUES('Sasuko', 'Divos', 'green street', 'It is good', , @Image, )


but i get a INSERT INTO error, why?




AnswerRe: please correct my query Pin
Colin Angus Mackay12-Jan-06 1:48
Colin Angus Mackay12-Jan-06 1:48 
GeneralRe: please correct my query Pin
Sasuko12-Jan-06 2:40
Sasuko12-Jan-06 2:40 
GeneralRe: please correct my query Pin
Colin Angus Mackay12-Jan-06 2:50
Colin Angus Mackay12-Jan-06 2:50 
AnswerRe: please correct my query Pin
Guffa12-Jan-06 2:23
Guffa12-Jan-06 2:23 
AnswerRe: please correct my query Pin
Sasuko12-Jan-06 4:49
Sasuko12-Jan-06 4:49 
QuestionUsing String.Replace method with variables Pin
sohne11-Jan-06 23:11
sohne11-Jan-06 23:11 
AnswerRe: Using String.Replace method with variables Pin
Colin Angus Mackay11-Jan-06 23:23
Colin Angus Mackay11-Jan-06 23:23 
QuestionImporting contacts to Microsoft Outlook with C# Pin
Starchild200511-Jan-06 21:59
Starchild200511-Jan-06 21:59 
QuestionHow can be a Transparent panel control can be created Pin
Shashidharreddy11-Jan-06 21:52
Shashidharreddy11-Jan-06 21:52 
AnswerRe: How can be a Transparent panel control can be created Pin
AB777111-Jan-06 23:53
AB777111-Jan-06 23:53 
AnswerRe: How can be a Transparent panel control can be created Pin
exhaulted12-Jan-06 3:24
exhaulted12-Jan-06 3:24 
Questionestablish GPRS connection Pin
Frank23111-Jan-06 20:58
Frank23111-Jan-06 20:58 
Questionwindows services Pin
PrakashBhaskar11-Jan-06 19:42
PrakashBhaskar11-Jan-06 19:42 
AnswerRe: windows services Pin
Mike Dimmick11-Jan-06 23:56
Mike Dimmick11-Jan-06 23:56 
Questiondetect sections Pin
picasso211-Jan-06 18:44
picasso211-Jan-06 18:44 
AnswerRe: detect sections Pin
Koushik Biswas12-Jan-06 6:15
Koushik Biswas12-Jan-06 6:15 
Questiondoubt in Infragistics.Win.UltraWinTree Pin
dhol11-Jan-06 17:56
dhol11-Jan-06 17:56 

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.