the 1 source by sagar inBy using given code you can easily create new table in aDatabase and fill records on that table
You can use this code on the Page_Load or in any Button click event
Try
If Not (conn.State = ConnectionState.Open) Then
conn.Open()
End If
Dim sql As String = "CREATE TABLE mySchoolRecord" + " (StudentId INTEGER CONSTRAINT PkeyMyId PRIMARY KEY," + "Name CHAR(50), Address CHAR(255), Contact INTEGER)"
cmd = New OdbcCommand(sql, conn)
cmd.ExecuteNonQuery()
Address,Contact) " + "VALUES (1, 'Mr. Manish', "
+ " 'Sector-12,Noida', 2447658 ) "
cmd = New OdbcCommand(sql, conn)
cmd.ExecuteNonQuery()
Address,Contact) " + "VALUES (2, 'Mr. Anand', " + " 'Mayur
Vihar,
cmd = New OdbcCommand(sql, conn)
cmd.ExecuteNonQuery()
Address,Contact) " + "VALUES (3, 'Miss Mona', " + "
'25,
cmd = New OdbcCommand(sql, conn)
cmd.ExecuteNonQuery()
If conn.State = ConnectionState.Open Then
conn.Close()
End If
Catch ex As OdbcException
MessageBox.Show(ex.Message.ToString)
End
Try
0 التعليقات:
Post a Comment