Hello,.. Im a New Guy to this forum and 1st of all;... Hi :twisted:
im a newbie to c# programming as well ,,, anyway.. i have a huge issue ..
here is what s going to happen..
if (txtPath.Text != "")
{
FileInfo fn = new FileInfo(txtPath.Text);
string p = txtPath.Text;
int pos = p.LastIndexOf(".");
string ext = p.Substring(pos + 1);
string newname = mid + "." + ext;
string path = Application.StartupPath.ToString() + "\\images\\" + newname;
fn.CopyTo(path);
sql = "INSERT INTO mobile(MID,MMNO,MPRICE,MINFO,MMANU,MPIC,MDOA) VALUES('" + mid + "','" + mmno + "','" + mprice + "','" + minfo + "','" + manu + "','" + newname + "','" + doa + "')";
dbcon.Open();
com = new OleDbCommand(sql, dbcon);
com.ExecuteNonQuery(); // executing the query ( sending the wehical )
MessageBox.Show("Successfully Inserted", "Record Insertion", MessageBoxButtons.OK, MessageBoxIcon.Information);
dbcon.Close();
picImage.ImageLocation = txtPath.Text;
txtPath.Clear();
FormClear();
txtMid.Focus();
}
using the above coding.. im uploading a image from my form to a folder in my application root.. the coding works fine... i must mention that im using ole-db as well in here to send data to the db /..
what happens is when i close this form after uploading the image and stuff.. the startup path is changed to the folder where i chose a image.. :P
ex - c:/users/myimages
and the software seeks the .Database in the directory where i chose a image to upload,,, ( in my example it would be c:/users/myimages ) when i reopen the same form the application path has changed :confused:
so my question is ,,,
is their a way to reset the application path ?
Tnx in advance ;)