سلام دوستان من میخوام این امکان رو به کاربر بدم که در صورتی که خواست یک داوطلب که سال پیش ثبت نام کرده و امسال مجددا" میخواد ثبت نام کنه رو از اطلاعات قبلیش کپی بگیره و در جدول دوباره قرار بده فقط فیلد سال ثبت نامشون متفاوته. اینم کدشه:
این راهی که من نوشتم اشتباهه کسی میتونه خط کپی کردنشو واسه من بگه؟؟؟
scm.CommandText =
"select idnumber,name,family,namep,codem,shsh,tarikht,maha let,taahol,tahsil,reshtet,shoghl,telkar,adres,telh ,tel,reshtem,salem,hefz,mosabeghe,sath,dafaat,rotb ed,reshte,khkeshvar,dore,keshvar,rotbek,jalase,mod at,nameo,madrak,sal,ghabul,ezam,haj,saleh,jensiyat from davtalab where codem='" + t9.Text + "'";
SqlDataReader reader = scm.ExecuteReader();
if (reader.Read())
{
DialogResult r1= MessageBox.Show(" . "," ",MessageBoxButtons.YesNo);
if (r1 == DialogResult.Yes)
{
try
{
SqlConnection tekrarco = newSqlConnection("Server=" + System.Net.Dns.GetHostName() + ";Database=oghaf;Integrated Security=true");
SqlCommand tekrar = newSqlCommand();
tekrarco.Open();
tekrar.Connection = tekrarco;
tekrar.CommandText =
"INSERT INTO davtalab (idnumber,name,family,namep,codem,shsh,tarikht,mah alet,taahol,tahsil,reshtet,shoghl,telkar,adres,tel h,tel,reshtem,salem,hefz,mosabeghe,sath,dafaat,rot bed,reshte,khkeshvar,dore,keshvar,rotbek,jalase,mo dat,nameo,madrak,sal,ghabul,ezam,haj,saleh,jensiya t)VALUES(select idnumber,name,family,namep,codem,shsh,tarikht,maha let,taahol,tahsil,reshtet,shoghl,telkar,adres,telh ,tel,reshtem,salem,hefz,mosabeghe,sath,dafaat,rotb ed,reshte,khkeshvar,dore,keshvar,rotbek,jalase,mod at,nameo,madrak,sal,ghabul,ezam,haj,saleh,jensiyat h from davtalab where codem='" + t9.Text + "' )";
این خط آخر رو باید چطوری تغییرش بدم؟این خطارو میده
incorrect syntax near the keyword 'select'.incorrect syntax near ')'