为什么我有这个问题? 我创造了" bdconsultas"在phpmyadmin但这个错误仍然出现
<?php
$conexion=mysql_connect("localhost","root","1234") or die("Problemas en la conexion");
mysql_select_db("bdconsultas",$conexion)
or die("Problemas en la seleccion de la base de datos");
mysql_query("insert into tconsultas(nombre,mail,mensaje)
values ('$_REQUEST[nombre]','$_REQUEST[mail]','$_REQUEST[mensaje]')",$conexion)
or die("Problemas en el select:".mysql_error());
mysql_close($conexion);
echo "El cliente fue dado de alta.";
?>
答案 0 :(得分:0)
您可以使用 string filePath = Server.MapPath("~/Content/MailMarketing/") + Path.GetFileName(flexcel.PostedFile.FileName);
flexcel.SaveAs(filePath);
//Open the Excel file using ClosedXML.
using (XLWorkbook workBook = new XLWorkbook(filePath))
{
//Read the first Sheet from Excel file.
IXLWorksheet workSheet = workBook.Worksheet(1);
//Create a new DataTable.
DataTable dt = new DataTable();
//Loop through the Worksheet rows.
bool firstRow = true;
foreach (IXLRow row in workSheet.Rows())
{
//Use the first row to add columns to DataTable.
if (firstRow)
{
foreach (IXLCell cell in row.Cells())
{
dt.Columns.Add(cell.Value.ToString());
}
firstRow = false;
}
else
{
//Add rows to DataTable.
dt.Rows.Add();
int i = 0;
foreach (IXLCell cell in row.Cells())
{
dt.Rows[dt.Rows.Count - 1][i] = cell.Value.ToString();
i++;
}
}
。
mysqli_*
&GT;
如需更多参考,请read here