首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

毕业论文即将上缴,请各位予以帮助,多谢!

2012-01-21 
毕业论文即将上缴,请各位予以帮助,谢谢!~~~~VB+SQL医院信息管理系统前台:病人编号:txtpatientnum姓名:txtp

毕业论文即将上缴,请各位予以帮助,谢谢!~~~~
VB+SQL   医院信息管理系统
前台:  
病人编号:txtpatientnum
姓名:txtpatientname
性别:cmbpgendar
年龄:txtage
保存:cmdok  
后台:   t_clinicpatient表
id,name,age,gendar,phone等
请问怎样在前台输入数据后可以保存到数据库里.求代码.谢谢!~~~~

[解决办法]
1.www.connectionstring.com找到合适的connectionstring
2.adodb.connection
3.adodb.recordset
sql= "insert into.. "
conn.open connectionstring
rs.open sql, conn,1,3

...
[解决办法]
通用模块加入
Public conn As New ADODB.Connection
Public rs As New Recordset

窗体模块加入
cmd_save_Click()
rs.Open "select * from t_clinicpatient ", conn, adOpenKeyset, adLockPessimistic
rs.AddNew
rs!txtpatientnum= c_rq
rs!txtpatientname = c_fl
rs!cmbpgendar = c_je1
rs!txtage = c_bz1
rs.Update
MsgBox "已添加成功 ", vbOKOnly + vbInformation, "血杀友情提示 "
rs.Close
Set rs = Nothing
大概就这个方法吧.
具体联系我.

不太明白你的具体意思.所以有可能回复的不好.
[解决办法]
以下是VB+SQL Server代码
创建数据库的代码文件为MyTest.sql文件内容如下:
CREATE DATABASE [Mytest] ON (NAME = N 'Mytest_Data ', FILENAME = N 'd:\Program Files\Microsoft SQL Server\MSSQL\data\Mytest_Data.MDF ' , SIZE = 1, FILEGROWTH = 1) LOG ON (NAME = N 'Mytest_Log ', FILENAME = N 'd:\Program Files\Microsoft SQL Server\MSSQL\data\Mytest_Log.LDF ' , SIZE = 1, FILEGROWTH = 1)
COLLATE Chinese_PRC_CI_AS
GO
use [Mytest]
GO
CREATE TABLE [dbo].[t_clinicpatient] (
[id] [bigint] IDENTITY (1, 1) NOT NULL ,
[name] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[age] [smallint] NOT NULL ,
[Sex] [bit] NOT NULL ,
[Phone] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[t_clinicpatient] WITH NOCHECK ADD
CONSTRAINT [PK_t_clinicpatient] PRIMARY KEY CLUSTERED
(
[id]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[t_clinicpatient] WITH NOCHECK ADD
CONSTRAINT [DF_t_clinicpatient_Sex] DEFAULT (1) FOR [Sex]
GO

CREATE PROCEDURE [GetNewID]
AS
declare @temp bigint
if exists (select [id] from dbo.t_clinicpatient)
begin
SELECT @temp=MAX([id]) FROM dbo.t_clinicpatient
set @temp=@temp+1
return @temp
end
else
begin
return 1
end
GO

CREATE PROCEDURE [insert_t_clinicpatient]
(@name_1 [varchar](50),
@age_2 [smallint],
@Sex_3 [bit],
@Phone_4 [varchar](50))

AS INSERT INTO [Mytest].[dbo].[t_clinicpatient]
( [name],
[age],
[Sex],
[Phone])

VALUES
( @name_1,
@age_2,
@Sex_3,
@Phone_4)
if @@error=0 return 1
GO

热点排行