大量数据的储存

本文介绍了使用SQL进行新闻及学生信息批量录入的方法,并探讨了如何通过动态构建SQL语句来简化大量字段的处理过程。此外,还提到了在面对众多输入框时,如何用循环方式构建SQL语句以实现数据的高效录入。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

做新闻发布时,这样一句话
INSERT INTO [HICCDS7].[dbo].[News] ([NewsTitle] ,[NewsContent] ,[NewsType] ,[NewsPublisher] ,[NewsTime]VALUES ('" + _NewsTitle + "' ,'" + _NewsContent + "' ,'" + _NewsType + "' ,'" + _NewsPublisher + "' ,'" + _NewsTime + "')
就好使了

今天做学生信息录入
INSERT INTO [HICCDS7].[dbo].[StdudentBasic_Inf] ([UserName] ,[Pwd] ,[StudentName] ,[Gender] ,[Birthday] ,[SNational] ,[PoliticalBackground] ,[Duty] ,[Hostels] ,[Grade] ,[Professional],[Classes],[Rankings],[EnglishGrading],[ComputerGrading],[Health],[Number],[IContact],[FamilyContact],[Province],[City],[Towns],[Village],[WhereCome],[WhenToPartySchool],[WhenPositive],[WhenToParty],[Introducer],[Award],[Sanctions],[RelativesCall1],[RelativesName1],[RelativesGender1],[RelativesBackground1],[RelativesDuty1],[RelativesCall2],[RelativesName2],[RelativesGender2],[RelativesBackground2],[RelativesDuty2],[RelativesCall3],[RelativesName3],[RelativesGender3],[RelativesBackground3],[RelativesDuaty3],[RelativesCall4],[RelativesName4],[RelativesGender4],[RelativesBackground4],[RelativesDuty4],[Introduction],[CounselorsViews])VALUES('" + TextBox16.Text + "','" + TextBox16.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + TextBox9.Text + "','" + TextBox10.Text + "','" + TextBox11.Text + "','" + TextBox12.Text + "','" + TextBox13.Text + "','" + TextBox14.Text + "','" + TextBox15.Text + "','" + TextBox16.Text + "','" + TextBox17.Text + "','" + TextBox18.Text + "','" + TextBox19.Text + "','" + TextBox20.Text + "','" + TextBox21.Text + "','" + TextBox22.Text + "','" + TextBox23.Text + "','" + TextBox24.Text + "','" + TextBox25.Text + "','" + TextBox26.Text + "','" + TextBox27.Text + "','" + TextBox28.Text + "','" + TextBox29.Text + "','" + TextBox30.Text + "','" + TextBox31.Text + "','" + TextBox32.Text + "','" + TextBox33.Text + "','" + TextBox34.Text + "','" + TextBox35.Text + "','" + TextBox36.Text + "','" + TextBox37.Text + "','" + TextBox38.Text + "','" + TextBox39.Text + "','" + TextBox40.Text + "','" + TextBox41.Text + "','" + TextBox42.Text + "','" + TextBox43.Text + "','" + TextBox44.Text + "','" + TextBox45.Text + "','" + TextBox46.Text + "','" + TextBox47.Text + "','" + TextBox48.Text + "','" + TextBox49.Text + "','" + TextBox50.Text + "','" + TextBox51 + "'"  + ")
用了这样的代码搞定~~~~~

其实我原本想这样呢.
string q = "";
        int a = 2;
        for (; a 
< 50; a++)
        {
           q 
= q + "'" + "+" + "TextBox" + a + ".Text+" + "'"+",";
        }
但没实现.

然后我突然想起还要做信息修改

快哭了~~~~~

转载于:https://www.cnblogs.com/gengxiaochao/archive/2007/09/10/888609.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值