我已经阅读了类似的帖子,但我无法弄清楚问题.
我更改了Windows权限并更改了路由.
当我尝试保存文件时,它会抛出异常:
访问路径****被拒绝.
string route="D:\\";
FileStream fs = new FileStream(route, FileMode.Create); <--here is the problem
StreamWriter write = new StreamWriter(fs);
patient person = new patient();
patient.name = textBox1.Text;
patient.name2 = textBox2.Text;
Run Code Online (Sandbox Code Playgroud) 我正在为一家小商店开发一个程序.当我单击"报告"按钮时,它必须显示一个表,如下所示:
列名"A","B"......"N"必须是员工的姓名.但我无法弄清楚如何.这是我的代码:
public void Inform()
{
String[] employee;
String[] product[];
this.setLayout(null);
Inform=new JTable(nulo, employee.length);
model = new DefaultTableModel() {
private static final long serialVersionUID = 1L;
@Override
public int getColumnCount() {
return 1;
}
@Override
public boolean isCellEditable(int row, int col) {
return false;
}
@Override
public int getRowCount() {
return Inform.getRowCount();
}
};
headerTable = new JTable(model);
for (int i = 0; i < Inform.getRowCount(); i++)
headerTable.setValueAt(product[i], i, 0);
headerTable.setShowGrid(false);
headerTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
headerTable.setPreferredScrollableViewportSize(new Dimension(50, 0));
headerTable.getColumnModel().getColumn(0).setPreferredWidth(50);
scrollPane = new JScrollPane(Inform); …
Run Code Online (Sandbox Code Playgroud) 尝试使用表单和PHP / IIS 7上传文件时,出现以下消息:
PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0
Run Code Online (Sandbox Code Playgroud)
我的表格:
<form action="acciones.php" id="form3" method="POST" enctype="multipart/form-data">
<input type="hidden" value="3" name="accion">
<input type="text" name="nombre" placeholder="Nombre">
<input type="file" name="imagen" accept="image/x-png, image/gif, image/jpeg" />
<input type="button" id="envio" class="button azul" value="Agregar" onclick="envios()">
</form>
Run Code Online (Sandbox Code Playgroud)
$target = "/images/";
$target = $target . basename( $_FILES['imagen']['name']);
//This gets all the other information from the form
$name=$_POST['nombre'];
$pic=($_FILES['imagen']['name']);
//Writes the information to the database
$query = "INSERT …
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个有2列的JTable,一个必须显示产品的名称,第二个,价格.问题是JTable非常小,所以我需要一个滚动,但我不能创建它.
DefaultTableModel model = new DefaultTableModel();
JTable productos = new JTable(model);
model.addColumn("Product");//name of the first columns
model.addColumn("Price");//name of the second columns
BTW: the table doesn't show the name of the column, but creates the 2 columns
for (i=0; i<null_copy4; i++)//null_copy4 is a integer that shows me how many stacks are used in the array
{
model.insertRow(model.getRowCount(), new Object[]{product_copy3[i],price_copy3[i]});
}
//product_copy3 and price_copy3 are arrays. String[] and integer[].
products.setBounds(5,50,200,200); //define the dimensions of the JTable
this.add(productos);//add it to the window
Run Code Online (Sandbox Code Playgroud)