emilychiong
12-15-2005, 02:44 PM
Dear experts, i'm still new in asp.net. I got problem in inserting data to database.. can u help me out? Thanksss..
|
Click to See Complete Forum and Search --> : how to insert data to SQL 2000 server in asp.net? emilychiong 12-15-2005, 02:44 PM Dear experts, i'm still new in asp.net. I got problem in inserting data to database.. can u help me out? Thanksss.. Cipher 12-16-2005, 06:23 AM Try this out, i'm not sure if it have a great difference, but try it anyway :) Try Dim cn As New SqlClient.SqlConnection("data source=CHIONG;initial catalog=library;integrated security=SSPI;persist security info=False;workstation id=CHIONG;packet size=4096") Dim SQL As String = "INSERT INTO member (MemEmail, MemPwd, MemFName, MemLName, MemGender, MemBirthMonth, MemBirthDay, MemBirthYear) VALUES ('" & EmailAdd.Text & "','" & Password2.Text & "','" & FirstName.Text & "','" & LastName.Text & "','" & genderlist.SelectedItem.Value & "','" & monthlist.SelectedItem.Value & "','" & daylist.SelectedItem.Value & "','" & yearlist.SelectedItem.Value & "')" Dim cm As New SqlClient.SqlCommand(SQL, cn) cn.Open() cm.ExecuteNonQuery() 'you should make any action here, like placing a label and write in it that 'insert is complete 'or redirect the user to other page cn.Close() Catch ex As Exception Response.Write(ex.Message) End Try emilychiong 12-16-2005, 09:54 PM Thanks.. I guess i din sign in for SQL server, that's why it gives me problems.. Thanks yea.. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |