Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.
Hi Experts,
could u guide me thru this pls:
1)items are displayed on a gridview control say 10 records
2)user clicks on inserts so that ALL items are imported into an oracle table (whilst calling a procedure)
when testing i deleted two records from the table
3)when i click on insert button again i expert to see 10 records and not 8
any suggestions pls, am i commiting too early on the oracle side?
protected void btnAnonyCourse_Click(object sender, EventArgs e)
{
OracleConnection con = null;
OracleCommand cmd = null;
try
{
con = new OracleConnection("Data Source=; User ID=;Password=");
cmd = new OracleCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
cmd.CommandText = "GEN_ANONY_ID_COURSECODE";
con.Open();
foreach (GridViewRow row in gvAcademy.Rows)
{
// if (row.RowType == DataControlRowType.DataRow)
{
string studRef = ((Label)row.FindControl("lblStudRef")).Text;
cmd.Parameters.Add("va_S_STUDENTREFERENCE", studRef).DbType = DbType.String;
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
lblMsg.Text = "Anonymous IDs by Course have been generated successfully";
}
}
}
catch (Exception ex)
{
lblMsg.Text = "<b>Message:</b> " + ex.Message;
}
finally
{
cmd.Dispose();
con.Dispose();
}
}
==============================
CREATE OR REPLACE PROCEDURE HE_REPORTING_DATABASE.GEN_ANONY_ID_COURSECODE
(va_S_STUDENTREFERENCE IN VARCHAR2)
AS
BEGIN
INSERT INTO HE_STORE_ANONYMOUS_ID
(P_ID,
S_STUDENTREFERENCE,
M_REFERENCE,
M_NAME,
MI_ILRA11X1,
VC_NAME,
S_LEGACY,
M_START,
M_END,
M_CLOSE,
P_SURNAME,
P_FORENAMES
)
SELECT P_ID,
S_STUDENTREFERENCE,
M_REFERENCE,
M_NAME,
MI_ILRA11X1,
VC_NAME,
S_LEGACY,
M_START,
M_END,
M_CLOSE,
P_SURNAME,
P_FORENAMES
FROM HE_GET_ANONYMOUS_ID
WHERE S_STUDENTREFERENCE = va_S_STUDENTREFERENCE
AND NOT EXISTS( SELECT NULL FROM HE_STORE_ANONYMOUS_ID WHERE S_STUDENTREFERENCE = va_S_STUDENTREFERENCE );
COMMIT;
End GEN_ANONY_ID_COURSECODE;
/
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78:
Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.
New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...
Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...
Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...
"The Oracle gurus provide answers, solutions and valuable workarounds"
User: schwertner
"Wow! Excellent, valuable explanation. Hats off to you"
User: aseshu70
"Solution worked fantastic and performs excellent! Thanks heaps"
User: klausbrandlhuber
Know a thing or two about Oracle? Join our team of experts today.
Posted on 2010-10-08 at 05:30:01ID: 34349620
All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.