Click here to Skip to main content
15,900,110 members
Home / Discussions / C#
   

C#

 
GeneralRe: Borland C DLL in C#.NET Pin
dataminers21-Mar-09 3:48
dataminers21-Mar-09 3:48 
AnswerRe: Borland C DLL in C#.NET Pin
Ravi Mori21-Mar-09 3:46
Ravi Mori21-Mar-09 3:46 
GeneralRe: Borland C DLL in C#.NET Pin
dataminers21-Mar-09 3:51
dataminers21-Mar-09 3:51 
GeneralRe: Borland C DLL in C#.NET Pin
Ravi Mori21-Mar-09 4:13
Ravi Mori21-Mar-09 4:13 
AnswerRe: Borland C DLL in C#.NET Pin
Xmen Real 21-Mar-09 4:11
professional Xmen Real 21-Mar-09 4:11 
GeneralRe: Borland C DLL in C#.NET Pin
dataminers21-Mar-09 5:06
dataminers21-Mar-09 5:06 
GeneralRe: Borland C DLL in C#.NET Pin
Ravadre21-Mar-09 6:23
Ravadre21-Mar-09 6:23 
Questionusing fileupload control any file will save and retrieve from database Pin
grkrishna21-Mar-09 2:45
grkrishna21-Mar-09 2:45 
this is my code plz help me here is my code.

public partial class customresearch : System.Web.UI.Page
{
SqlConnection cn = new SqlConnection("database=researchmind;Data Source=NEWSOFT;User id=sa;Password=abc123");
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();

protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnSubmit_Click(object sender, EventArgs e)
{
SqlDataAdapter da = new SqlDataAdapter();

da = new SqlDataAdapter("insert into customresearch_t(title,firstname,lastname,jobtitle,company,address1,address2,"
+ "city,state,zipcode,country,email,phone,fax,description,find) values('" + ddlTitle.SelectedValue.ToString() + "','"
+ txtFirst.Text + "','" + txtLast.Text + "','" + txtJobtitle.Text + "','" + txtCompany.Text + "','" + txtAddress1.Text + "','"
+ txtAddress2.Text + "','" + txtCity.Text + "','" + txtState.Text + "','" + txtZipcode.Text + "', '" + ddlCountry.SelectedItem.ToString() + "','"
+ txtEmail.Text + "','" + txtphone.Text + "','" + txtFax.Text + "','" + txtDesc.Text + "','" + ddlFind.SelectedValue.ToString()+ "' )", cn);
da.Fill(ds);
string filepath = Server.MapPath(Request.ApplicationPath + "//");
string filename = Path.GetFileName(filepath);
FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read);

BinaryReader br = new BinaryReader(fs);
byte[] bytes = br.ReadBytes((Int32)fs.Length);
br.Close();
fs.Close();
string query = "insert into uploadfile_t(Name,ContentType,Data) values (@Name,@ContentType,@Data)";
SqlCommand cmd = new SqlCommand(query);
cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = filename;
cmd.Parameters.Add("@ContentType", SqlDbType.VarChar).Value = "ContentType";
cmd.Parameters.Add("@Data", SqlDbType.Binary).Value = bytes;
//cmd.Parameters.Add("@requirement", SqlDbType.VarChar).Value = "application/vnd.ms-word";
InsertUpdateData(cmd);

}
private Boolean InsertUpdateData(SqlCommand cmd)
{
cmd.CommandType=CommandType.Text;
cmd.Connection=cn;
try
{
cn.Open();
cmd.ExecuteNonQuery();
return true;
}
catch(Exception ex)
{
Response.Write(ex.Message);
return false;
}
finally
{
cn.Close();
cn.Dispose();
}
}
}



the following error will come
Could not find a part of the path 'C:\Documents and Settings\icon\Desktop\researchmind\'.

plz any one help me
any file will save and retrieve from db
AnswerRe: using fileupload control any file will save and retrieve from database Pin
Xmen Real 21-Mar-09 4:15
professional Xmen Real 21-Mar-09 4:15 
GeneralRe: using fileupload control any file will save and retrieve from database Pin
grkrishna21-Mar-09 20:46
grkrishna21-Mar-09 20:46 
GeneralRe: using fileupload control any file will save and retrieve from database Pin
Xmen Real 21-Mar-09 21:26
professional Xmen Real 21-Mar-09 21:26 
GeneralRe: using fileupload control any file will save and retrieve from database Pin
grkrishna21-Mar-09 23:05
grkrishna21-Mar-09 23:05 
GeneralRe: using fileupload control any file will save and retrieve from database Pin
grkrishna22-Mar-09 0:03
grkrishna22-Mar-09 0:03 
GeneralRe: using fileupload control any file will save and retrieve from database Pin
grkrishna23-Mar-09 2:23
grkrishna23-Mar-09 2:23 
QuestionLdap authentication on Vista? Pin
Ronni Marker21-Mar-09 2:34
Ronni Marker21-Mar-09 2:34 
QuestionConvert PDF to Tiff Pin
Sun Rays21-Mar-09 2:18
Sun Rays21-Mar-09 2:18 
AnswerRe: Convert PDF to Tiff Pin
dan!sh 21-Mar-09 2:25
professional dan!sh 21-Mar-09 2:25 
GeneralRe: Convert PDF to Tiff Pin
Sun Rays21-Mar-09 2:27
Sun Rays21-Mar-09 2:27 
GeneralRe: Convert PDF to Tiff Pin
dan!sh 21-Mar-09 3:09
professional dan!sh 21-Mar-09 3:09 
Questionperforming button click automatically without performing it Pin
sashidhar21-Mar-09 2:04
sashidhar21-Mar-09 2:04 
AnswerRe: performing button click automatically without performing it Pin
Ravi Mori21-Mar-09 3:36
Ravi Mori21-Mar-09 3:36 
AnswerRe: performing button click automatically without performing it Pin
DaveyM6921-Mar-09 9:33
professionalDaveyM6921-Mar-09 9:33 
QuestionConversion from ascii to unicode Pin
tauras8121-Mar-09 1:15
tauras8121-Mar-09 1:15 
AnswerRe: Conversion from ascii to unicode Pin
dan!sh 21-Mar-09 1:25
professional dan!sh 21-Mar-09 1:25 
AnswerRe: Conversion from ascii to unicode Pin
PIEBALDconsult21-Mar-09 4:39
mvePIEBALDconsult21-Mar-09 4:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.