1.C# save as 保存当前网页图片到服务器上 怎么写
protected void Button1_Click(object sender, EventArgs e){//上传图片string connection = .ConnectionStrings["ConnectionString1"].ConnectionString;SqlConnection conn = new SqlConnection(connection);string path = Server.MapPath("~/Picture");string filepath = FileUpload1.PostedFile.FileName;string name = filepath.Substring(filepath.LastIndexOf("\\")+1);//获取文件名string Extend = filepath.Substring(filepath.LastIndexOf(".")+1);//获取格式名if (Extend == "jpg" || Extend == "gif" || Extend == "bmp"){FileUpload1.SaveAs(path + "\\" + name);string filepath1 = "~/Picture/" + name; //这里的Picture是指你要图片上传到的服务器文件夹 可以自己改conn.Open();string sql = "insert into Picture values('" + filepath1 + "')";SqlCommand cmd = new SqlCommand(sql, conn);cmd.ExecuteNonQuery();Response.Write("");}else{Response.Write("");}}其实你这个问题在百度很多啊 最后希望可以帮助你。
2.C# save as 保存当前网页图片到服务器上 怎么写
protected void Button1_Click(object sender, EventArgs e){//上传图片string connection = .ConnectionStrings["ConnectionString1"].ConnectionString;SqlConnection conn = new SqlConnection(connection);string path = Server.MapPath("~/Picture");string filepath = FileUpload1.PostedFile.FileName;string name = filepath.Substring(filepath.LastIndexOf("\\")+1);//获取文件名 Extend = filepath.Substring(filepath.LastIndexOf(".")+1);//获取格式名if (Extend == "jpg" || Extend == "gif" || Extend == "bmp"){FileUpload1.SaveAs(path + "\\" + name);string filepath1 = "~/Picture/" + name; //这里的Picture是指你要图片上传到的服务器文件夹 可以自己改conn.Open();string sql = "insert into Picture values('" + filepath1 + "')";SqlCommand cmd = new SqlCommand(sql, conn);cmd.ExecuteNonQuery();Response.Write("");}else{Response.Write("");}}其实你这个问题在百度很多啊 最后希望可以帮助你。
3.关于C# SaveAs方法
使用SaveAs的方法请参看以下语句:
string savepath = Server.MapPath("filesPath");
//HttpContext.Request.MapPath("FilesPath")
HttpPostedFile.SaveAs(savepath);
saveas 只能保存到本地地盘上,不能保存一个网络地址上,可以把地址\\172.20.1.26\SalarySystem\映射成为一个网络驱动器,然后再用saveas保存。
类似 saveas("z:\\salary.xls").
4.wincc中c语言SaveAs怎么用
不确定你的m到底是什么内容,你最好先只验证SaveAs如何使用,先不要用m来传递文件名,改用字符串常量直接传递来验证:
pExcel->ActiveWorkbook->SaveAs("D:\\myfile.xls");
这样运行看看D盘下有没有生成myfile.xls文件。
SaveAs()的括号里填的应该是字符串类型,例如:
char m[20]="D:\\myfile.xls";
pExcel->ActiveWorkbook->SaveAs(m);
5.如何调用SaveAs函数
刚接触wps开发,下了LuciferStar 导出的头文件,以及demo代码。
我想在代码里面加入一句另存为的代码,但是不知道从哪里下手,请大神指点。
原代码:
HRESULT hr;
CApplication m_wps;
hr=CoInitialize(NULL);
//hr=CreateObject();
// 通过CLSID启动WPS
if (!m_wps.CreateDispatch(_T("KWPS.Application")))
{
MessageBox(_T("Error!Creat WPS Application Server Faile!"));
return;
}
6.C#编程中如何将打开的文件重新保存而不出现Save As页面
SaveAs界面其实只是一个选择文件路径的弹窗,保存文件到指定的目录下是需要其它代码的;不同的文件格式是需要不同的代码(通常文件的打开和保存是相对的,有打开文件的方法就有保存文件的方法)
如果是打开的文件内容,那肯定知道打开文件的路径;你只要验证这个路径的文件是否存在就行了
SaveFileDialog dialog = new SaveFileDialog();
dialog.Title = "保存文件";
dialog.RestoreDirectory = true;
dialog.AddExtension = true;
var path="";//这是打开的文件路径
if(File.Exists(path))
{
//此处执行对应文件的Save方法,此方法一般需要path作为参数来表示文件保存的位置
}
else
{
if (dialog.ShowDialog() == DialogResult.OK)
{
path = dialog.FileName;
}
else
return;
//此处执行对应文件的Save方法,此方法一般需要path作为参数来表示文件保存的位置
}
7.vb另存为(saveas)命令存autocad文件如何设置密码,要求写一个vb码
参考方法AcadSecurityParams
Sub Example_Action()
' This example encrypts and saves a file.
Dim acad As New AcadApplication
Dim sp As New AcadSecurityParams
acad.Visible = True
sp.Action = .ACADSECURITYPARAMS_ENCRYPT_DATA
sp.Algorithm = .ACADSECURITYPARAMS_ALGID_RC4
sp.KeyLength = 40
sp.Password = UCase("mypassword") 'AutoCAD converts all passwords to uppercase before applying them
sp.ProviderName = "Microsoft Base Cryptographic Provider v1.0"
sp.ProviderType = 1
acad.ActiveDocument.SaveAs "C:\MyDrawing.dwg", , sp
End Sub
转载请注明出处育才学习网 » csaveas地址怎么写