PDA

View Full Version : این اشتباهه؟



h-rafiee
دوشنبه 25 مهر 1390, 10:56 صبح
یکی بگه اینی که نوشتم درسته یا نه؟
FileSource = txtthesis_path.Text;
FileDestination = Application.StartupPath + @"\PDF\" + txtobj.Text + ".pdf";
System.IO.File.Copy(FileSource, FileDestination, true);
SqlConnection cn = new SqlConnection(connection);
SqlCommand cmd = new SqlCommand();
cmd.Connection = cn;
cmd.CommandType = CommandType.Text;
cn.Open();
cmd.CommandText = "insert into thesis_table" +
"(stuFname,stuLname,session_id,obj_thesis,perofesso r,year,thesis_path)" +
"values(@stuFname,@stuLname,@session_id,@obj_thesis ,@perofessor,@year,@thesis_path)";
cmd.Parameters.AddWithValue("@stuFname", txtFname.Text);
cmd.Parameters.AddWithValue("@stuLname",txtLname.Text);
cmd.Parameters.AddWithValue("@session_id",txtsession_id.Text);
cmd.Parameters.AddWithValue("@obj_thesis", txtobj.Text);
cmd.Parameters.AddWithValue("@perofessor",txtperofessor.Text);
cmd.Parameters.AddWithValue("@year",txtyear.Text);
cmd.Parameters.AddWithValue("@thesis_path", FileDestination);
cmd.ExecuteNonQuery();
cn.Close();

artapc.com
دوشنبه 25 مهر 1390, 11:20 صبح
با سلام
اول توضیح بدین می خواین چه کاری انجام بدین تا بشه کمکتون کرد

h-rafiee
دوشنبه 25 مهر 1390, 12:10 عصر
مقصد رو میخوام در بانک ذخیره کنم.
FileDestination محلی است که PDF ای ذخیره میشه که این آدرس در بانک میخوام ذخیره بشه.

Z_Bagheri
دوشنبه 25 مهر 1390, 12:21 عصر
این اشتباهه ، شما فایلی آپلود نکردید، با یک اسم محتویات فایل ذخیره نمیشه.
برای این کار از openFileDialogue استفاده کنید ، به ترتیب زیر



DialogResult result = openFileDialog1.ShowDialog();

if (result == DialogResult.OK) .

{

string file = openFileDialog1.FileName;

....

h-rafiee
دوشنبه 25 مهر 1390, 12:35 عصر
این اشتباهه ، شما فایلی آپلود نکردید، با یک اسم محتویات فایل ذخیره نمیشه.
برای این کار از openFileDialogue استفاده کنید ، به ترتیب زیر



DialogResult result = openFileDialog1.ShowDialog();

if (result == DialogResult.OK) .

{

string file = openFileDialog1.FileName;

....

عزیزم من این کار رو کردم و یک مبدا وجود داره... اما آیا ذخیره میشه داخل بانک؟