当前位置:首页 » 操作系统 » 把数据存到数据库

把数据存到数据库

发布时间: 2022-02-04 18:43:03

⑴ 请问在网页制作的如何将用户输入的数据保存到sql数据库

原因:
1、可能你Asp服务器未启动,不能解析Asp脚本,所以让你下载
2、你的2.asp页面出错了(数据库出错,获取变量出错,一些操作出错),你可以下载下来,看看你2.asp中输出的什么,页面出错可能导致

你的流程是正确的,还有建议 method="post"

⑵ 怎么把数据保存到数据库

1.要下载一个对应你数据库的驱动包,如 sqlserver2008.java; 灵魂伴侣手写.
2.然后写个连接数据库的类.如JDBC.(连接数据库方法有很多种, 按照技术来分,首先学会JDBC连接数据库,然后连接池,然后框架技术Hibernate.) 灵魂伴侣手写.
3.每个数据库的表对应一张实体类,实体类是干什么用的? 1.用它可以OOP的思想的去操作数据库.
(增删改查), 表中的字段就封装成实体类里面的一个属性. 如表里是name char(10),那么实体类对应的是private String name;

⑶ 怎么将exel表中数据存入到数据库

将excle表中数据存入到数据库的方法步骤如下:

1、打开SQL Server Management Studio,按图中的路径进入导入数据界面。

⑷ 用java怎样把数据存到数据库中

只能写个大概的,要写数据到数据库中,先得在数据库中建库,库里建表,表里建字段,然后java里建立数据库连接,用SQL语言写数据到表中的字段
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
//String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=数据库名"; //7.0、2000
String url="jdbc:sqlserver://localhost:1433;DatabaseName=数据库名"; //2005
Connection conn=null;
conn= DriverManager.getConnection(url,用户名,密码);
PreparedStatement pst=null;
pst=conn.prepareStatement("Insert Into grade(表名) Values (?)");
pst.setInt(1,你要写的整弄数据);
//pst.setString(2,你要写的字符串数据);
pst.addBatch();
pst.executeBatch();

⑸ java怎么将收集到的数据存入数据库

你要达到的目的其实就是在jvm启动的时候把数据库数据加载一份到内存,一个静态变量和一个静态初始化块就可以搞定你的问题,这两者都是在类加载的时候初始化一次,像前面回答的一样,你可以用一个HashMap搞定。
稍微具体来说,一个静态变量
public static final Map<key,value> cache=new HashMap<key,value>()
static {
cache=请求数据库操作
}

key你自己加,String还是int都行,value是你数据库的结构,可以写个实体。获取的时候直接cache.get(key)就可以了。

⑹ 关于把数据存储到数据库的问题

你是什么语言实现的?
C# 还是 JAVA?

⑺ 如何将网页内提交的数据保存到SQL数据库中

表单提交之后,经过验证,当然你也可以不验证,先连接你的数据库,用sql语句
这里我用PHP给你粗略的写一下,
$conn = mysql_connect('数据库地址','数据库用户名','数据库密码');
mysql_select_db('连接到哪个表',$conn);
到这里连接到数据库,
然后别人提交的内容会通过表单,post或者get提交方式提交给你,你就把数据插入到数据库中就可以了,insert in to 具体的可以去看PHP的教程

⑻ 怎样把文本文档里存储的数据存到数据库

将带有格式的文本保存到数据库中的方法/步骤:
1、在jsp中,页面的带有格式的文本内容外面用一个大的标签,给定表签名。
2、页面做提交的时候用上面的表签名点innerHTML的方式来获取页面带有标签和样式的内容。
3、将上面取得的内容作为一个字符串保存到数据库即可,下次把数据库里的内容直接输出到页面就可以了。
对于要输出到word里保存样式的方法也是类似的,只是需要去看一下word解析文本的方式与jsp有何区别,在输出到word的时候做一下变换即可。

⑼ 如何:将数据从对象保存到数据库

有关更多信息,请参见 TableAdapter 概述。若要保存对象集合中的数据,请循环通过对象集合(例如,for-next 循环),然后使用 TableAdapter 的 DBDirect 方法之一将每个对象的值发送到数据库中。默认情况下,DBDirect 方法在 TableAdapter 上创建,能够直接对数据库执行操作。这些方法可以直接调用,它们不要求 DataSet 或DataTable 对象来协调更改即可将更新发送到数据库。注意配置TableAdapter 时,主查询必须提供足够的信息,才能创建 DBDirect 方法。例如,如果将 TableAdapter 配置为从未定义主键列的表中查询数据,它将不会生成 DBDirect 方法。 TableAdapter DBDirect 方法 说明TableAdapter.Insert向数据库中添加新记录,此方法允许将值作为方法参数传入各个列。TableAdapter.Update更新数据库中的现有记录。Update 方法将原始列值和新列值用作方法参数。原始值用于定位原始记录,新值用于更新该记录。通过将 DataSet、DataTable、DataRow、或 DataRow 数组用作方法参数,TableAdapter.Update 方法还可用于将数据集中的更改协调回数据库。TableAdapter.Delete在基于作为方法参数传入的原始列值的数据库中,删除其现有记录。将对象中的新记录保存到数据库中通过将值传递给 TableAdapter.Insert 方法可创建这些记录。下面的示例通过将 currentCustomer 对象中的值传递给 TableAdapter.Insert 方法,在 Customers 表中创建一项新的客户记录。 Visual Basic PrivateSub AddNewCustomer(ByVal currentCustomer As Customer) CustomersTableAdapter.Insert( _ currentCustomer.CustomerID, _ currentCustomer.CompanyName, _ currentCustomer.ContactName, _ currentCustomer.ContactTitle, _ currentCustomer.Address, _ currentCustomer.City, _ currentCustomer.Region, _ currentCustomer.PostalCode, _ currentCustomer.Country, _ currentCustomer.Phone, _ currentCustomer.Fax) EndSub C# privatevoid AddNewCustomers(Customer currentCustomer) { customersTableAdapter.Insert( currentCustomer.CustomerID, currentCustomer.CompanyName, currentCustomer.ContactName, currentCustomer.ContactTitle, currentCustomer.Address, currentCustomer.City, currentCustomer.Region, currentCustomer.PostalCode, currentCustomer.Country, currentCustomer.Phone, currentCustomer.Fax); } J# privatevoid AddNewCustomers(Customer currentCustomer) { .Insert( currentCustomer.get_CustomerID(), currentCustomer.get_CompanyName(), currentCustomer.get_ContactName(), currentCustomer.get_ContactTitle(), currentCustomer.get_Address(), currentCustomer.get_City(), currentCustomer.get_Region(), currentCustomer.get_PostalCode(), currentCustomer.get_Country(), currentCustomer.get_Phone(), currentCustomer.get_Fax()); }将对象中的现有记录更新到数据库修改记录:调用 TableAdapter.Update 方法并传入新值可更新记录,而传入原始值可定位记录。注意对象需要保留其原始值,才能将它们传递给 Update 方法。此示例使用前缀为 orig 的属性存储原始值。下面的示例通过将 Customer 对象中的新值和原始值传递给 TableAdapter.Update 方法,更新 Customers 表中的现有记录。 Visual Basic PrivateSub UpdateCustomer(ByVal cust As Customer) CustomersTableAdapter.Update( _ cust.CustomerID, _ cust.CompanyName, _ cust.ContactName, _ cust.ContactTitle, _ cust.Address, _ cust.City, _ cust.Region, _ cust.PostalCode, _ cust.Country, _ cust.Phone, _ cust.Fax, _ cust.origCustomerID, _ cust.origCompanyName, _ cust.origContactName, _ cust.origContactTitle, _ cust.origAddress, _ cust.origCity, _ cust.origRegion, _ cust.origPostalCode, _ cust.origCountry, _ cust.origPhone, _ cust.origFax) EndSub C# privatevoid UpdateCustomer(Customer cust) { customersTableAdapter.Update( cust.CustomerID, cust.CompanyName, cust.ContactName, cust.ContactTitle, cust.Address, cust.City, cust.Region, cust.PostalCode, cust.Country, cust.Phone, cust.Fax, cust.origCustomerID, cust.origCompanyName, cust.origContactName, cust.origContactTitle, cust.origAddress, cust.origCity, cust.origRegion, cust.origPostalCode, cust.origCountry, cust.origPhone, cust.origFax); } J# privatevoid UpdateCustomer(Customer cust) { .Update( cust.get_CustomerID(), cust.get_CompanyName(), cust.get_ContactName(), cust.get_ContactTitle(), cust.get_Address(), cust.get_City(), cust.get_Region(), cust.get_PostalCode(), cust.get_Country(), cust.get_Phone(), cust.get_Fax(), cust.get_origCustomerID(), cust.get_origCompanyName(), cust.get_origContactName(), cust.get_origContactTitle(), cust.get_origAddress(), cust.get_origCity(), cust.get_origRegion(), cust.get_origPostalCode(), cust.get_origCountry(), cust.get_origPhone(), cust.get_origFax()); }删除数据库中的现有记录通过调用 TableAdapter.Delete 方法并传入原始值定位记录,可删除记录。注意对象需要保留其原始值,才能将它们传递给 Delete 方法。 Visual Basic PrivateSub DeleteCustomer(ByVal cust As Customer) CustomersTableAdapter.Delete( _ cust.origCustomerID, _ cust.origCompanyName, _ cust.origContactName, _ cust.origContactTitle, _ cust.origAddress, _ cust.origCity, _ cust.origRegion, _ cust.origPostalCode, _ cust.origCountry, _ cust.origPhone, _ cust.origFax) EndSub C# privatevoid DeleteCustomer(Customer cust) { customersTableAdapter.Delete( cust.origCustomerID, cust.origCompanyName, cust.origContactName, cust.origContactTitle, cust.origAddress, cust.origCity, cust.origRegion, cust.origPostalCode, cust.origCountry, cust.origPhone, cust.origFax); } J# privatevoid DeleteCustomer(Customer cust) { .Delete( cust.get_origCustomerID(), cust.get_origCompanyName(), cust.get_origContactName(), cust.get_origContactTitle(), cust.get_origAddress(), cust.get_origCity(), cust.get_origRegion(), cust.get_origPostalCode(), cust.get_origCountry(), cust.get_origPhone(), cust.get_origFax()); }安全您必须具有相应的权限,才能对数据库中的表执行选定的 INSERT、UPDATE 或 DELETE。

热点内容
pythonshutdown 发布:2024-09-19 10:04:07 浏览:561
ftp连接工具安装 发布:2024-09-19 09:56:57 浏览:192
nba2kol2安卓手游怎么下 发布:2024-09-19 09:55:28 浏览:11
服务器换位置了ip地址怎么换 发布:2024-09-19 09:33:50 浏览:798
javarest 发布:2024-09-19 09:28:43 浏览:753
密码子的原料是什么 发布:2024-09-19 09:11:42 浏览:348
半夜编程 发布:2024-09-19 09:11:36 浏览:104
海康威视存储卡质量如何 发布:2024-09-19 08:55:35 浏览:941
python3默认安装路径 发布:2024-09-19 08:50:22 浏览:517
环卫视频拍摄脚本 发布:2024-09-19 08:35:44 浏览:419