>tplEntry = string.Format("INSERT INTO Programs2Times (" + > "[ProgramID],[TimeOfProgram],[EndTime],[Fee],[VolunteerFee],[VolunteersReq],[Canceled]" + > ",[Facilitator]) VALUES({0},'{{0}} {1}','{{0}} {2}', " + > "{3}, {4}, {5}, 0, '{6}')\n", ProgramID, StartTime, EndTime, this.txtbProgFee.Text, > VolFee, this.txtbProgVolReq.Text, this.txtbPrgFacilitator.Text);>
Hasttable ht = new Hashtable ht.Add(ProgramID) ht.ADd(StartTime) ht.Add(EndTime) ht.Add(this.txtbProgFee.Text) ht.Add(VolFee) ht.Add(this.txtbProgVolReq.Text) ht.Add(this.txtbPrgFacilitator.Text)Then create your insert statement:
INSERT INTO Programs2Times ([ProgramID],[TimeOfProgram],[EndTime],[Fee],[VolunteerFee],[VolunteersReq],[Canceled], [Facilitator]) VALUES (@p1, @p2, @p3, @p4,@p5, @p6, @p7)Create your command object, add the insert string as text, and add the parameters to your command object:
/// <summary> /// /// </summary> /// <param name="parameterHash"></param> /// <returns></returns> private IDbCommand AddParametersToCommandFromHash(IDbCommand command, Hashtable parameterHash) { if (parameterHash != null) { foreach (DictionaryEntry entry in parameterHash) { command.Parameters.Add(_provider.CreateParameter((string)entry.Key, entry.Value)); } } return command; }