我有一个SQL Server列引号的问题,它不接受超过5位数。 5位数或以下它工作正常,但超过5位数,它会导致错误:
xx.xx.xx.xx没有发送任何数据 ERR_EMPTY_RESPONSE
示例 - 引号12345
工作正常,但123456
会导致错误。
我还在查询中将bindParam更改为bindValue,但不是结果。
连接:
try {
$proconn = new PDO("dblib:host=$servername;dbname=TableQuote;charset=UTF-8", $username, $password);
// set the PDO error mode to exception
$proconn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
echo "Connection failed" . $e->getMessage;
}
可变数据:
//$quote_number="123456";
[quote_noumber] => '12345'
[inside_sales] => 'Pat Zerphy'
[outside_sales] => 'SEL102'
[customer_code] => 'SEL101'
[custome_name] => 'Selex Systems Inegrations'
[customer_contact] => 'Bob Smith'
[quote_details] => 'Misc coax cable assemblies.
1/2" Superflex, 1/4" Superflex'
[rna_location] => '1'
[number_of_line_items] => '25'
[created] => '1468291705'
插入查询:
try {
$prosql = $proconn->prepare("insert into dbo.QuoteRecord(quote_number,customer_code,customer_name,rna_location,inside_sale,outside_sale,customer_contact,quote_detail,number_of_line_items,created)VALUES(:quote_number,:customer_code,:customer_name,:rna_location,:inside_sale,:outside_sale,:customer_contact,:quote_detail,:number_of_line_items,:created)");
$prosql->bindParam(':quote_number',$quote_number);
$prosql->bindParam(':customer_code',$customer_code);
$prosql->bindParam(':customer_name',$customer_name);
$prosql->bindParam(':rna_location',$rna_location);
$prosql->bindParam(':inside_sale',$inside_sale);
$prosql->bindParam(':outside_sale',$outside_sale);
$prosql->bindParam(':customer_contact',$customer_contact);
$prosql->bindParam(':quote_detail',$quote_detail);
$prosql->bindParam(':number_of_line_items',$number_of_line_items);
$prosql->bindParam(':created',$created);
$prosql->execute();
}
catch ( PDOException $e ) {
print( "Error connecting to SQL Server." );
die(print_r($e));
}
数据类型:
Array
(
[TABLE_CATALOG] => TableQuote
[0] => proALPHA
[TABLE_SCHEMA] => dbo
[1] => dbo
[TABLE_NAME] => QuoteRecord
[2] => QuoteRecord
[COLUMN_NAME] => quote_number
[3] => quote_number
[ORDINAL_POSITION] => 2
[4] => 2
[COLUMN_DEFAULT] =>
[5] =>
[IS_NULLABLE] => YES
[6] => YES
[DATA_TYPE] => varchar
[7] => varchar
[CHARACTER_MAXIMUM_LENGTH] => 128
[8] => 128
[CHARACTER_OCTET_LENGTH] => 128
[9] => 128
[NUMERIC_PRECISION] =>
[10] =>
[NUMERIC_PRECISION_RADIX] =>
[11] =>
[NUMERIC_SCALE] =>
[12] =>
[DATETIME_PRECISION] =>
[13] =>
[CHARACTER_SET_CATALOG] =>
[14] =>
[CHARACTER_SET_SCHEMA] =>
[15] =>
[CHARACTER_SET_NAME] => iso_1
[16] => iso_1
[COLLATION_CATALOG] =>
[17] =>
[COLLATION_SCHEMA] =>
[18] =>
[COLLATION_NAME] => SQL_Latin1_General_CP1_CI_AS
[19] => SQL_Latin1_General_CP1_CI_AS
[DOMAIN_CATALOG] =>
[20] =>
[DOMAIN_SCHEMA] =>
[21] =>
[DOMAIN_NAME] =>
[22] =>
)
答案 0 :(得分:1)
示例 - 报价编号 - 12345工作正常但123456给予 错误。
如果是这种情况那么很可能是因为列quote_number
的列大小定义。看起来它是VARCHAR
列,如果它仍然没有错,您可能已将其大小设置为VARCHAR(5)
。
发布dbo.QuoteRecord
表格的表格定义或架构。