Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sch_Date SJ (Facultycode)
25/2/2013 ARPA / MFA (Coursename)

i want to save in the database as follows;

Sch_Date Facultycode Coursename

25/2/2013 SJ ARPA
25/2/2013 SJ MFA

Save code as follows;

C#
sql = "insert into Tb_SCh_TIme_Table([Sch_Date], [Course],[Faculty_Code])" + " values ('" + Convert.ToDateTime(datagridView.Rows[i].Cells[0].Value.ToString()) + "',  '" + datagridView[j, i].Value.ToString() + " / " + datagridView[j,i].Value.ToString () + "','" + datagridView.Columns[j].HeaderText.ToString() + "')";


using the above code to save in database,

in database save as follows;

Sch_Date Facultycode Coursename
25/2/2013 SJ ARPA / MFA

but i want the ouput as follows

Sch_Date Facultycode Coursename

25/2/2013 SJ ARPA
25/2/2013 SJ MFA

please help me how can i do using csharp.

Note it is windows application.
Posted
Updated 27-Feb-13 22:16pm
v2
Comments
CHill60 28-Feb-13 6:13am    
You need to clarify your question. From the code you've posted you look to be saving the course name twice with a '/' between
datagridView[j, i].Value.ToString() + " / " + datagridView[j,i].Value.ToString ()
But I think you are saying that datagridView[j,i] contains text "ARPA / MFA" ?
But you want this on the data base as two separate rows - one for ARPA and another for MFA?
[no name] 28-Feb-13 7:28am    
in database i want to save as follows;
Sch_Date Faculty_code CourseName
25/2/2013 SJ ARPA
25/2/2013 SJ MFA

i want to save the two course for the same faculty_Code.

how can i split it up and save in the database.

how can i write the code to save the two course split up and save it in the database.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900