Click here to Skip to main content
15,890,336 members
Home / Discussions / C#
   

C#

 
Questionc# and query result Pin
User34903-Jul-13 9:11
User34903-Jul-13 9:11 
AnswerRe: c# and query result Pin
Pete O'Hanlon3-Jul-13 10:09
mvePete O'Hanlon3-Jul-13 10:09 
GeneralRe: c# and query result Pin
User34903-Jul-13 10:15
User34903-Jul-13 10:15 
GeneralRe: c# and query result Pin
Pete O'Hanlon3-Jul-13 10:20
mvePete O'Hanlon3-Jul-13 10:20 
GeneralRe: c# and query result Pin
User34903-Jul-13 10:23
User34903-Jul-13 10:23 
GeneralRe: c# and query result Pin
Pete O'Hanlon3-Jul-13 10:29
mvePete O'Hanlon3-Jul-13 10:29 
GeneralRe: c# and query result Pin
KiranKumar Roy3-Jul-13 20:10
KiranKumar Roy3-Jul-13 20:10 
GeneralRe: c# and query result Pin
User34904-Jul-13 11:11
User34904-Jul-13 11:11 
ok i make a class and i have there the following code:

public DataTable findrefyear(string dateref)
{

try
{
//Set the access command string
string query_insert = "INSERT INTO Questionnaires_Table (BranchName,Factor,Region,Branch_ID,[Current_Date],No_Employees,"
+ "No_Cashdesk,UrbanArea,TouristArea,RuralArea,GreenLinearArea,CentralStreets,EscapeBack,Collonization,"
+ "TimeDelay,PatrolPolice,Visibility,SafeBoxRisk,StaffAccess,KeyboardActiviation,ConnectionKSC,GSMCommunicator,SystemAlarmRisk,"
+ "InstalledSKKT,CheckSKKT,CheckDesk,CheckEntrance,SKKTRisk,RenovatedStore,MetalCashDrawers,ExtensionCash,Limits,"
+ "CashDrawers,CasherRisk,WarningAlert,SecurityWarningDelay,WarningRisk,BothSideDoors,"
+ "DoorsSound,ExitRisk,EmergencyCase,RobberyCase,DescriptionForm,SeminarRobbery,EducationRisk,ReferenceYear) "
+ "SELECT BranchName,Factor,Region,Branch_ID,Current_Date,No_Employees,"
+ "No_Cashdesk,UrbanArea,TouristArea,RuralArea,GreenLinearArea,CentralStreets,EscapeBack,Collonization,"
+ "TimeDelay,PatrolPolice,Visibility,(TimeDelay+PatrolPolice+Visibility)/3,StaffAccess,KeyboardActiviation,ConnectionKSC,GSMCommunicator,(StaffAccess+KeyboardActiviation+ConnectionKSC+GSMCommunicator)/4,"
+ "InstalledSKKT,CheckSKKT,CheckDesk,CheckEntrance,(InstalledSKKT+CheckSKKT)/2,RenovatedStore,MetalCashDrawers,ExtensionCash,Limits,"
+ "CashDrawers,(CheckDesk+CheckEntrance+RenovatedStore+MetalCashDrawers+ExtensionCash+Limits+CashDrawers)/7,"
+ "WarningAlert,SecurityWarningDelay,(WarningAlert+SecurityWarningDelay)/2,BothSideDoors,"
+ "DoorsSound,(BothSideDoors+DoorsSound)/2,"
+ "EmergencyCase,RobberyCase,DescriptionForm,SeminarRobbery,(EmergencyCase+RobberyCase+DescriptionForm+SeminarRobbery)/4,ReferenceYear "
+ "FROM [MS Access;DATABASE=" + dialog.FileName + "].Questionnaires_Table1 Where ReferenceYear = '" +dateref + "';";


//create new new access connection to the database
OleDbConnection conn = new OleDbConnection(ConnectionString);
//create new access data adapter
OleDbDataAdapter oleDBAdapter = new OleDbDataAdapter(query_insert, conn);
//create new access command builder
OleDbCommandBuilder oleDBBuilder = new OleDbCommandBuilder(oleDBAdapter);

dTable = new DataTable();
oleDBAdapter.Fill(dTable);
conn.Close();
}
catch (OleDbException e)
{
MessageBox.Show(e.ToString());
}
//return the search results on a datatable
return dTable;

}

Also i have in appropriate form the following code that call the query when it is work:

dbConnDest.Open();

DataTable find_data = importrefyear.findrefyear(dateref.Text);
if (find_data.Rows.Count >= 1)
{
"How i CAll the query from here???"

}



Also the SELECT Count(1)is the above method i use ??
Questionc# and query result Pin
User34903-Jul-13 7:21
User34903-Jul-13 7:21 
AnswerRe: c# and query result Pin
OriginalGriff3-Jul-13 8:35
mveOriginalGriff3-Jul-13 8:35 
QuestionCommon Trace Format in C# Pin
srikumarrampa3-Jul-13 4:08
srikumarrampa3-Jul-13 4:08 
AnswerRe: Common Trace Format in C# Pin
Pete O'Hanlon3-Jul-13 4:51
mvePete O'Hanlon3-Jul-13 4:51 
QuestionInstall application without install SQLSERVER Pin
dharmaa.m2-Jul-13 8:38
dharmaa.m2-Jul-13 8:38 
AnswerRe: Install application without install SQLSERVER Pin
Ron Beyer2-Jul-13 9:18
professionalRon Beyer2-Jul-13 9:18 
GeneralRe: Install application without install SQLSERVER Pin
dharmaa.m2-Jul-13 9:44
dharmaa.m2-Jul-13 9:44 
GeneralRe: Install application without install SQLSERVER Pin
Ron Beyer2-Jul-13 9:50
professionalRon Beyer2-Jul-13 9:50 
AnswerRe: Install application without install SQLSERVER Pin
Manu V Nath3-Jul-13 23:30
professionalManu V Nath3-Jul-13 23:30 
GeneralRe: Install application without install SQLSERVER Pin
Eddy Vluggen4-Jul-13 0:01
professionalEddy Vluggen4-Jul-13 0:01 
QuestionC# deployment creating a porject folder Pin
classy_dog2-Jul-13 6:38
classy_dog2-Jul-13 6:38 
AnswerRe: C# deployment creating a porject folder Pin
NickPace3-Jul-13 6:30
NickPace3-Jul-13 6:30 
QuestionHow to combine ClickOnce and normal installer Pin
MathijsBeentjes2-Jul-13 5:47
MathijsBeentjes2-Jul-13 5:47 
AnswerRe: How to combine ClickOnce and normal installer Pin
GuyThiebaut3-Jul-13 0:08
professionalGuyThiebaut3-Jul-13 0:08 
QuestionRadio buttons in PropertyGrid Pin
lukeer1-Jul-13 21:02
lukeer1-Jul-13 21:02 
AnswerRe: Radio buttons in PropertyGrid Pin
Eddy Vluggen1-Jul-13 22:30
professionalEddy Vluggen1-Jul-13 22:30 
GeneralRe: Radio buttons in PropertyGrid Pin
lukeer11-Jul-13 1:21
lukeer11-Jul-13 1:21 

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.