我有这个代码,它不工作,但我不是为什么?
try
{
saveFileDialog1.Filter = "SQL Server database backup files|*.bak";
saveFileDialog1.Title = "Database Backup";
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
SqlCommand bu2 = new SqlCommand();
SqlConnection s = new SqlConnection("Data Source=M1-PC;Initial Catalog=master;Integrated Security=True;Pooling=False");
bu2.CommandText = String.Format("BACKUP DATABASE LA TO DISK='{0}'", saveFileDialog1.FileName);
s.Open();
bu2.ExecuteNonQuery();
s.Close();
MessageBox.Show("ok");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
替代文字http://i39.tinypic.com/2zhh34k.png
问题是什么?
我正在开发一个PHP网站,让用户上传图像然后让他决定图像应该如何使用jQuery - PHP整合来选择想要成为图片的区域,然后单击裁剪按钮来裁剪它和保存.
我面临的问题是,并非所有图像类型都能很好地裁剪和保存,所以我注意到它可以很容易地将图像转换为JPG,然后让用户裁剪它,因为它是一种简单的方法. JPG格式.
我怎么能这样做?
这是图像类型问题的最佳解决方案吗?
编辑:
我正在使用此代码裁剪图像,它不是以PNG格式拍摄,也仅限于3分机.
$path_parts = pathinfo("../images/DVDs/".$_POST['logo_file']);
if ($path_parts['extension'] == "png") {
$src = imagecreatefrompng("../images/DVDs/".$_POST['logo_file']);
$tmp = imagecreatetruecolor(350, 494);
imagecopyresampled($tmp, $src, 0,0,$_POST['x'],$_POST['y'],350,494,$_POST['w'],$_POST['h']);
imagepng($tmp, "../images/DVDs/$filename".'t_'.$_POST['logo_file'],100);
} else if ($path_parts['extension'] == "jpg" || $path_parts['extension'] == "jpeg") {
$src = imagecreatefromjpeg("../images/DVDs/".$_POST['logo_file']);
$tmp = imagecreatetruecolor(350, 494);
imagecopyresampled($tmp, $src, 0,0,$_POST['x'],$_POST['y'],350,494,$_POST['w'],$_POST['h']);
imagejpeg($tmp, "../images/DVDs/$filename".'t_'.$_POST['logo_file'],100);
} else if ($path_parts['extension'] == "gif") {
$src = imagecreatefromgif("../images/DVDs/".$_POST['logo_file']);
$tmp = imagecreatetruecolor(350, 494);
imagecopyresampled($tmp, $src, 0,0,$_POST['x'],$_POST['y'],350,494,$_POST['w'],$_POST['h']);
imagegif($tmp, "../images/DVDs/$filename".'t_'.$_POST['logo_file'],100);
}
Run Code Online (Sandbox Code Playgroud)
我想将图像转换为JPG格式,因为它最容易转换而没有任何问题.
我有这个代码:
private void FillCombobox()
{
using (InventoryEntities c = new InventoryEntities(Properties.Settings.Default.Connection))
{
List<Customer> usepurposes = c.Customers.ToList();
DataTable dt = new DataTable();
dt.Columns.Add("id");
dt.Columns.Add("name");
foreach (Customer usepurpose in usepurposes)
{
dt.Rows.Add(usepurpose.id, usepurpose.name);
}
comboBox1.ValueMember = dt.Columns[0].ColumnName;
comboBox1.DisplayMember = dt.Columns[1].ColumnName;
comboBox1.DataSource = dt;
}
}
Run Code Online (Sandbox Code Playgroud)
我将此方法称为:
private void frmBillIn_Load(object sender, EventArgs e)
{
FillCombobox();
}
Run Code Online (Sandbox Code Playgroud)
当我运行我的应用程序时,组合框将不会显示客户(项目).
只显示Model.Customer
问题是什么??
我尝试了很多解决方案,但没有解决方案.
我有这个问题,我不知道什么是最好的解决方案.
我有一个名为Employees的表,并且有一个名为LastWork的列,此列应该只有我选择的自定义值,例如:
value 1
value 2
Run Code Online (Sandbox Code Playgroud)
我希望用户从ComboBox控件中选择值,所以我有2个想法,但我不知道它最适合它.
A - 将这些值作为Items属性中的字符串添加到Combobox,并将它们作为字符串存储在DB中.
B - 在我的数据库中创建单独的表,例如'LastWork',带有2列'LastWorkID','LastWorkName'并在其中插入我的值,然后我可以添加绑定源控件,我可以使用数据绑定项来存储id在我的主表中作为整数显示用户的LastWorkName.
我更喜欢使用B方法,因为在某些形式中我有带编辑权限的DataGridView控件,我想在其中显示Combobox而不是Textbox来从这些自定义值中进行选择.
我希望你理解我的问题.
我需要知道如何从PHP中存储在我的数据库中的文本中获取前n个单词?
例如,如果我的数据库中有一些文本像这样:
"word1 word2 word3 word4 text one test four four"
我如何从本文中获得前4或5个单词?
我在我的第2页DIV上使用了jScrollPane,我希望每个都有自己的跟踪栏,默认情况下,这个属性存在于CSS文件中并应用于2个DIV.
我想为第二个DIV添加一个特定的轨道栏而不与第一个DIV交互.
我怎么能这样做?
谢谢
我有一个旧数据库,其中一个表包含许多列,其中一个列名为oper,其类型为varchar,此表中有180,000多行,此列的值可以是以下值之一:
first
second
third
fourth
fifth
Run Code Online (Sandbox Code Playgroud)
现在我更新了我的表并使数据类型为int.所以,如果我想插入旧数据我不能因为类型之间的不同(int - string).
我需要一些方法来循环抛出表行并检查oper的值
如果old值等于"first",则复制该行并首先更改为1并将此行放入新表中
如果旧值等于"秒",则复制该行并首先更改为2并将此行放入新表中
等等 .....
有什么方法可以做到吗?
我正在做这些步骤:
我试图重置vs2010设置,但没有好消息,问题仍然存在.
我也尝试过使用ASP.NET网站.
问题是什么?