社区
C#
帖子详情
请教小问题高手问题
zhangjingcheng
2007-09-01 11:00:39
Response.Write("<script>alert('数据已经存在')</script>");
输出的时候提示不能用说/是换行符
应该怎么写?
...全文
119
8
打赏
收藏
请教小问题高手问题
Response.Write("alert('数据已经存在')"); 输出的时候提示不能用说/是换行符 应该怎么写?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
8 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
zhangjingcheng
2007-09-03
打赏
举报
回复
怎么就没人呢?
bbdog
2007-09-01
打赏
举报
回复
Response.Write(@"<script>alert('数据已经存在')</script>");//试一下下?
zhangjingcheng
2007-09-01
打赏
举报
回复
一个样子
wjg06
2007-09-01
打赏
举报
回复
Response.Write("<script>alert('数据已经存在');</script>");
zhangjingcheng
2007-09-01
打赏
举报
回复
编译器错误信息: CS1010: 常量中有换行符
行 109: {
行 110: Response.Write("数据已经存在!");
行 111: Response.Write("<script>alert('数据已经存在')</script>");
行 112: }
行 113: else
zhangjingcheng
2007-09-01
打赏
举报
回复
我是写在页面里面的
包含在<script runat="server">里面的 提示说/是换行符
不知道怎么写了
sky_97
2007-09-01
打赏
举报
回复
应该没有问题啊
zhangjingcheng
2007-09-01
打赏
举报
回复
不行啊
还是一样的错误!
<script runat="server">
private void Page_Load(Object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
ImgPreview.Visible=false;
}
}
void GetThumbnailImage(int width,int height,string strInfo,int left,int right)
{
string file = "image/" + uploadFile.PostedFile.FileName.Substring(uploadFile.PostedFile.FileName.LastIndexOf('\\') + 1);
string newfile = "image/" + uploadFile.PostedFile.FileName.Substring(uploadFile.PostedFile.FileName.LastIndexOf('\\') + 1) + ".jpg";
string strAdd=strInfo;
System.Drawing.Image oldimage = System.Drawing.Image.FromFile(Server.MapPath(file));
System.Drawing.Image thumbnailImage =
oldimage.GetThumbnailImage(width, height,new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);
Response.Clear();
Bitmap output=new Bitmap(thumbnailImage);
Graphics g=Graphics.FromImage(output);
g.DrawString(strAdd,new Font("Courier New", 14),new SolidBrush(Color.Red),left,right);
output.Save(Server.MapPath(newfile),System.Drawing.Imaging.ImageFormat.Jpeg);
Response.ContentType = "image/gif";
ImgPreview.Visible=true;
ImgPreview.ImageUrl=newfile;
Label1.Text = "生成新图片显示:";
Oldimage.Text = file;
Newimage.Text = newfile;
}
bool ThumbnailCallback()
{
return true;
}
void Button_Click(object sender, EventArgs e)
{
int width,height,left,right;
string strAddInfo=txtAddInfo.Text;
width=Int32.Parse(txtWidth.Text);
height=Int32.Parse(txtHeight.Text);
left=Int32.Parse(txtLeft.Text);
right=Int32.Parse(txtRight.Text);
if(!(uploadFile.PostedFile.ContentLength>0))
{
lblErrInfo.Text="没有选择文件!";
}
else
{
string path = Server.MapPath("./image/"+uploadFile.PostedFile.FileName.Substring(uploadFile.PostedFile.FileName.LastIndexOf('\\')+1));
if(File.Exists(path))
{
lblErrInfo.Text="已经有同名文件!";
}
else
{
uploadFile.PostedFile.SaveAs(path);
GetThumbnailImage(width,height,strAddInfo,left,right);
starimage.Text = "";
lblErrInfo.Text = "";
}
}
}
protected void starn_Click(object sender, EventArgs e)
{
if (TextBox1.Text.Trim() == "")
{
starname.Text = "信息简称不能为空!";
startext.Text = "";
starimage.Text = "";
}
else if (TextBox3.Text.Trim() == "")
{
startext.Text = "请填写下面的详细信息!";
starname.Text = "";
starimage.Text = "";
}
else if (Oldimage.Text.Trim() == "" || Newimage.Text.Trim() == "")
{
starimage.Text = "请先上传图片!";
startext.Text = "";
starname.Text = "";
}
else
{
starname.Text = "";
startext.Text = "";
starimage.Text = "";
string star1=DropDownList1.Text.ToString();
string star2 = TextBox1.Text;
string star3 = TextBox3.Text;
string Oldimages=Oldimage.Text;
string Newimages=Newimage.Text;
string starconn = "user id=sa;password=123;initial catalog=aspx;server=KEYJOB;Connect TimeOut=60";
SqlConnection conn = new SqlConnection(starconn);
conn.Open();
SqlCommand star = new SqlCommand("select * from admintext where starname='" + star2 + "'", conn);
SqlDataReader stars = star.ExecuteReader();
if (stars.Read())
{
Response.Write("数据已经存在!");
}
else
{
stars.Close();
SqlCommand starrs = new SqlCommand("insert into admintext (titleid,starname,inttime,startext,Oldimage,Newimage) values('" + star1 + "','" + star2 + "','" + System.DateTime.Now + "','" + star3 + "','" + Oldimages + "','" + Newimages + "')", conn);
SqlDataReader rs = starrs.ExecuteReader();
if (rs.Read())
{
Response.Write("数据添加成功!");
}
}
}
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
starimage.Text = "";
starname.Text = "";
startext.Text = "";
TextBox3.Text = "";
TextBox1.Text = "";
Oldimage.Text = "";
Newimage.Text = "";
ImgPreview.ImageUrl = "";
ImgPreview.Visible = false;
Label1.Text = "";
}
</script>
问题
请教
高手
问题
请教
高手
问题
请教
高手
如何
请教
问题
且以后都会回答你的方法
一、如何
请教
问题
在网上与人沟通时,学会客气,并且开门见山的把
问题
说清楚非常必要,还要带上你努力的过程, 并且尽量不要问开放式的
问题
,例如:你问一句,回答者可能要10句才能解答的
问题
不要问。 二、...
我想
请教
各位
高手
一个
问题
!
我想
请教
各位
高手
一个
问题
,我用的是.net2003智能化手持的开发。 在调用服务程序时(用winform写的)开始时是正常的,可是没调两次就会出现一个异常,而不能再调用服务程序上的函数,异常中出现的错误如下: 未...
请教
高手
几个linux的
问题
XP和RED HAT LINUX 9的双系统,启动管理器用的GRUB,如果把LINUX的盘格式化了,还 能不能进WINDOWS了。 ...而且重启了以后不能进LINUX 的图形操作界面了,由于本人是LINUX新手,不知道用哪个命令可以进X...请
高手
赐教。
向
高手
请教
我是学习QTP新人,希望各位
高手
指导下,有什么好的资源,分享下呀~!
C#
110,571
社区成员
642,568
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章