Click here to Skip to main content
15,916,280 members
Home / Discussions / C#
   

C#

 
AnswerRe: loading a combobox without repitition, how to?? Pin
Drew McGhie7-Feb-07 8:34
Drew McGhie7-Feb-07 8:34 
QuestionApplication not terminating with Application.exit Pin
Nitin19817-Feb-07 7:22
Nitin19817-Feb-07 7:22 
AnswerRe: Application not terminating with Application.exit Pin
Shy Agam7-Feb-07 7:44
Shy Agam7-Feb-07 7:44 
GeneralHow to terminate the application completely Pin
Nitin19818-Feb-07 0:50
Nitin19818-Feb-07 0:50 
GeneralRe: How to terminate the application completely Pin
Shy Agam8-Feb-07 2:02
Shy Agam8-Feb-07 2:02 
Questionburn data Pin
karname7-Feb-07 7:17
karname7-Feb-07 7:17 
AnswerRe: burn data Pin
Ravi Bhavnani7-Feb-07 7:41
professionalRavi Bhavnani7-Feb-07 7:41 
QuestionSQL Statment Pin
microuser_20007-Feb-07 7:15
microuser_20007-Feb-07 7:15 
Hellow to all ...

i am trying to run an SQL statment on my DB database i wanna pick from the statment a field after inserting i tried to run this code but i always recive this error " Multiple-step OLE DB operation generated errors .... "

string SQLContract;
int ContractIndx;
ClsInfo Assist_Var = new ClsInfo();

try

{

SQLContract = "INSERT Contract( " +
"ClientNum,ContractType,BDate,EDate," +
"UDate,PDate,ContratOption,PropertyNum,"+
"HierMeters,MeterPrice,Remarks)" +
"VALUES( " +
txt_Client_Name.Text + "," +
Assist_Var.PrepareStr("B") + "," +
Assist_Var.PrepareStr(dtFromDate.Text) + "," +
Assist_Var.PrepareStr(dtToDate.Text) + "," +
Assist_Var.PrepareStr(dtChange.Text) + "," +
Assist_Var.PrepareStr(dtLastPay.Text) + "," +
Assist_Var.Val(txtYears.Text) + "," +
Assist_Var.Val(txtPropertyID.Text) + "," +
Assist_Var.Val(txtMeters.Text) + "," +
Assist_Var.Val(txtMeterPrice.Text) + "," +
Assist_Var.PrepareStr(txtRemarks.Text) + "); " +
"SELECT @Indx = @@IDENTITY" ;

OleDbConnection OleDbConn = new OleDbConnection(Assist_Var.SQLConnection());
OleDbConn.Open();

OleDbCommand OleDbCommand = new OleDbCommand();

OleDbCommand.CommandText = SQLContract;
OleDbCommand.CommandType = CommandType.Text;
OleDbCommand.Connection = OleDbConn;
OleDbParameter MyPara = new OleDbParameter();
MyPara = new OleDbParameter("@Indx",OleDbType.Integer , 4);
MyPara.Direction = ParameterDirection.Output;
OleDbCommand.Parameters.Add(MyPara);




OleDbCommand.ExecuteNonQuery();
ContractIndx = Convert.ToInt32(OleDbCommand.Parameters["@Indx"].Value);

MessageBox.Show(ContractIndx.ToString());

OleDbConn.Close();
OleDbConn.Dispose();
OleDbCommand.Dispose();
}



catch (Exception ex)
{
MessageBox.Show(ex.Message);
}


thxx to u ...

AnswerRe: SQL Statment Pin
Pete O'Hanlon7-Feb-07 8:50
mvePete O'Hanlon7-Feb-07 8:50 
GeneralRe: SQL Statment Pin
microuser_20007-Feb-07 10:40
microuser_20007-Feb-07 10:40 
GeneralRe: SQL Statment Pin
Colin Angus Mackay7-Feb-07 12:06
Colin Angus Mackay7-Feb-07 12:06 
GeneralRe: SQL Statment Pin
microuser_20008-Feb-07 9:36
microuser_20008-Feb-07 9:36 
GeneralRe: SQL Statment Pin
Colin Angus Mackay8-Feb-07 11:09
Colin Angus Mackay8-Feb-07 11:09 
GeneralRe: SQL Statment Pin
microuser_20008-Feb-07 11:21
microuser_20008-Feb-07 11:21 
Questionis it possible to use a value type in a generic method constraint? Pin
michal.kreslik7-Feb-07 7:14
michal.kreslik7-Feb-07 7:14 
AnswerRe: is it possible to use a value type in a generic method constraint? Pin
Judah Gabriel Himango7-Feb-07 7:41
sponsorJudah Gabriel Himango7-Feb-07 7:41 
GeneralRe: is it possible to use a value type in a generic method constraint? Pin
michal.kreslik7-Feb-07 8:05
michal.kreslik7-Feb-07 8:05 
GeneralRe: is it possible to use a value type in a generic method constraint? Pin
Judah Gabriel Himango7-Feb-07 8:55
sponsorJudah Gabriel Himango7-Feb-07 8:55 
GeneralRe: is it possible to use a value type in a generic method constraint? Pin
michal.kreslik7-Feb-07 9:11
michal.kreslik7-Feb-07 9:11 
GeneralRe: is it possible to use a value type in a generic method constraint? Pin
Judah Gabriel Himango7-Feb-07 9:27
sponsorJudah Gabriel Himango7-Feb-07 9:27 
GeneralRe: is it possible to use a value type in a generic method constraint? Pin
michal.kreslik7-Feb-07 10:44
michal.kreslik7-Feb-07 10:44 
QuestionHow to capture Datagrid Header Text events? Pin
sundar1567-Feb-07 6:59
sundar1567-Feb-07 6:59 
AnswerRe: How to capture Datagrid Header Text events? Pin
Ravi Bhavnani7-Feb-07 7:07
professionalRavi Bhavnani7-Feb-07 7:07 
QuestionHow to add file onto txbbox? [modified] Pin
Eyungwah7-Feb-07 6:47
Eyungwah7-Feb-07 6:47 
AnswerRe: How to add file onto txbbox? Pin
Ravi Bhavnani7-Feb-07 6:57
professionalRavi Bhavnani7-Feb-07 6:57 

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.