Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Help me in inserting data in sqlserver

Author  Topic 

hary.jack
Starting Member

4 Posts

Posted - 2009-05-01 : 08:11:34
Hello Friends,
i m new in sqlserver, i m using sqlserver database with asp page,
i want to insert the record from web page into the Database. but it insert null values into the database.

Can any body provide me some help regarding this.

my connection string is ok & connection is open.


code is below:
<%
Dim uid, pass, pass2, coun, cit, stat, ph
set uid= Request.Form("name")
set pass=Request.Form("password")
set pass2= Request.Form("password2")
set coun=Request.Form("country")
set cit= Request.Form("city")
set stat=Request.Form("state")
set ph= Request.Form("phone")

Dim conn
set conn=Server.CreateObject("ADODB.Connection")
conn.open("Provider='SQLOLEDB.1'; Data Source = 'IT'; Initial Catalog = 'test'; User Id ='sa'; Password='gdp';")

If conn.errors.count = 0 Then
conn.Execute "insert into sant(name,password,password2,country,city,state,phone)"&_"values( '" & uid & "', '" & pass & "', '" & pass2 & "', '" & coun & "', '" & cit & "', '" & stat & "', '" & ph & "' )"

End If
conn.close

%>

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-07 : 13:40:33
check if you're getting values correctly from form.
Go to Top of Page

hary.jack
Starting Member

4 Posts

Posted - 2009-05-07 : 18:29:09
thanx dear
i will check this.

can u tell me where i can learn Active server Pages with sqlserver database operational code.i mean sample example for these so i can learn & use it properly in my project.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-05-07 : 21:38:21
http://www.4guysfromrolla.com/
Go to Top of Page

hary.jack
Starting Member

4 Posts

Posted - 2009-05-11 : 06:56:40
ok dear, any site where only used the sqlserver database rather than acess.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-05-11 : 07:05:46
4Guys has examples with SQL Server, and if they use another DB the examples most likely work just as well on SQL Server.
Go to Top of Page
   

- Advertisement -