我的表结构,
P_Id Int Primary key
Cat_Id Int Foreign key
Product_Name Nvarchar(50) Not Null
Model_No Nvarchar(50) Not Null
Price Numeric(10,2) Not Null
Photo mediumblob Not Null
Available Varchar(5) Not Null
Display Nvarchar(10) Not Null
Processor Nvarchar(50) Not Null
Platform Nvarchar(50) Not Null
Simcard Nvarchar(50) Not Null
Memory Nvarchar(20) Not Null
Pcamera Nvarchar(50) Not Null
Scamera Nvarchar(50) Not Null
Battery Nvarchar(30) Not Null
Ram Nvarchar(20) Not Null
这是我的jsp页面
<form id="form1" action="UploadDBServlet" enctype="multipart/form-data" method="post">
<h2 align="center"> Add Product Here:</h2>
<table border="1" bgcolor="grey" style="color:blue">
<tr>
<td>
<!-- <b>Product_id</b> -->
</td>
<td>
<input type="hidden" name="pd" />
</td>
</tr>
<tr>
<td>
<b>Product Category:</b>
</td>
<td>
<select name="product">
<option value="Sony Ericsson">Sony Ericsson</option>
<option value="Nokia">Nokia</option>
<option value="Htc">HTC</option>
<option value="Samsung">Samsung</option>
<option value="micromax">Micromax</option>
</select>
</td>
</tr>
<tr>
<td>
<b>Product Name:</b>
</td>
<td>
<input type="text" name="pname">
</td>
</tr>
<tr>
<td>
<b>Model No:</b>
</td>
<td>
<input type="text" name="mnum">
</td>
</tr>
<tr>
<td>
<b>Price:</b>
</td>
<td>
<input type="text" name="price">
</td>
</tr>
<tr>
<td>
<b>Photo:</b>
</td>
<td>
<input type="file" name="Photo" value="" />
</td>
</tr>
<tr>
<td><b>Availability:</b></td>
<td>Yes <input type="radio" name="al"> No <input
type="radio" name="al">
</td>
</tr>
<tr>
<td><b>Display:</b></td>
<td><input type="text" name="disp"></td>
</tr>
<tr>
<td><b>Processor:</b></td>
<td><input type="text" name="proc"></td>
</tr>
<tr>
<td><b>Platform:</b></td>
<td><input type="text" name="plat"></td>
</tr>
<tr>
<td><b>Sim Card:</b></td>
<td><input type="text" name="sim"></td>
</tr>
<tr>
<td><b>Memory:</b></td>
<td><input type="text" name="mem"></td>
</tr>
<tr>
<td><b>Primary Camera:</b></td>
<td><input type="text" name="pc"></td>
</tr>
<tr>
<td><b>Secondary Camera:</b></td>
<td><input type="text" name="sc"></td>
</tr>
<tr>
<td><b>Battery:</b></td>
<td><input type="text" name="bat"></td>
</tr>
<tr>
<td><b>Ram:</b></td>
<td><input type="text" name="ram"></td>
</tr>
<tr>
<td><input type="submit" value="Add Product" id="box"></td>
<td><input type="reset" value="Reset" id="box"></td>
</tr>
</table>
</form>
感谢任何帮助。
提前致谢
答案 0 :(得分:0)
为什么要将图像存储在数据库中?通常,程序员所做的是将图像存储在目录中,并仅将URL存储在数据库中;不是图像本身。想象一下,只需100张图像,您的数据库将变得多大和多慢。