Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

hi

i m a cmpleletely newbie in this asp.net field.I have written the following module to update my database by clicking a button. But its giving me an error msg at the line MyAdapter.Fill(MyTable); saying "invalid table name".

protected void cmdupdate_Click(object sender, EventArgs e)
       {
           if (Page.IsPostBack==true)
           {
               DataTable MyTable = new DataTable();
               System.Data.OracleClient.OracleConnection conn;
               OracleCommand cmd;

               string cmdString1 = "update table hr_rmc_file_mast set file_division=FILE_DIVISION.Text,file_no=FILE_NO.Text,project_code=PROJECT_CODE.Text,no_of_noting=NO_OF_NOTING.Text,no_of_corresponence=NO_OF_CORRESP.Text,subject=SUBJECT.Text,record_class=RECORD_CLASS.Text,prv_ref=PRV_REF.Text,later_ref=LATER_REF.Text,retention_period=RETENTION_PERIOD.Text,destruction_year=DESTRUCTION_YEAR.Text,proceeding_no=PROCEEDING_NO.Text ,user_id=USER_ID.Text ,trans_date=TRANS_DATE.Text,comp_no=COMP_NO.Text,rec_no=REC_NO.Text,sent_by=SENT_BY.Text,sent_dt=SENT_DT.Text where file_no=FILE_NO.Text";
               //conn = new OracleConnection("User Id=system;Password=project;Data Source=SqlDataSource1");
               conn = new OracleConnection(ConfigurationManager.ConnectionStrings["ConnectionString12"].ConnectionString);
               cmd = new OracleCommand(cmdString1, conn);
               OracleDataAdapter MyAdapter = new OracleDataAdapter();
               conn.Open();
               MyAdapter.SelectCommand = cmd;
               MyAdapter.Fill(MyTable);
              ListView1.DataSource=MyTable.DefaultView;
              ListView1.DataBind();
              MyAdapter.Dispose();
              cmd.Dispose();
              conn.Dispose();


              // conn.Close();


           }
       }

I'll b vry grateful if ny1 cud hlp me wid dis.!!

Edited by PlausiblyDamp
Posted (edited)

thnx 4 replying...

u mean 2 say ..i shud give a whole valid row as an input. I hv tried it but its not wrking nyway!!:(

A similar error comes up with my insert func with cmd.ExecuteNonQuery()

Code:

 

protected void Button1_Click(object sender, EventArgs e)

{

 

System.Data.OracleClient.OracleConnection conn;

OracleCommand cmd;

//string cmdString = "Select CompanyName from Customers";

 

 

string cmdString = "insert into hr_rmc_file_mast(file_division,file_no,project_code,no_of_noting,no_of_corresponence,subject,record_class,prv_ref,later_ref,retention_period,destruction_year,proceeding_no ,user_id ,trans_date ,comp_no ,rec_no ,sent_by ,sent_dt ) values('" + FILE_DIVISION.Text + "', '"

+ FILE_NO.Text + "', '" + PROJECT_CODE.Text + "', '" + NO_OF_NOTING.Text + "', '" + NOOFCORRESP.Text + "', '" + SUBJECT.Text + "', '"

+ RECORD_CLASS.Text + "', '" + PRV_REF.Text + "', '" + LATER_REF.Text + "', '" + RETENTION_PERIOD.Text + "', '" + DESTRUCTION_YEAR.Text + "', '"

+ PROCEEDING_NO.Text + "', '" + USER_ID.Text + "', '" + TRANS_DATE.Text + "', '" + COMP_NO.Text + "', '" + REC_NO.Text + "', '" + SENT_BY.Text + "', '"

+ SENT_DT.Text + "');";

 

 

conn = new OracleConnection(ConfigurationManager.ConnectionStrings["ConnectionString12"].ConnectionString);

cmd = new OracleCommand(cmdString, conn);

conn.Open();

cmd.ExecuteNonQuery();

 

 

conn.Close();

 

}

[/CS]

Plz hlp!!

Edited by PlausiblyDamp

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...