![]() |
| ||
| Create Table on SqlServer Through Asp.net coding Anyone can help me as soon as possible. I want to create table on my database. i tried Following code Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ConStr As String = "Data Source=Urjit6;Initial Catalog=MyDB;Integrated Security=True" Dim MyCon As New SqlConnection(ConStr) Dim SqlCom As New SqlCommand Dim server As New Server(New ServerConnection(MyCon)) 'Create object for database Dim db As Database = server.Databases("MyDB") 'Create Table Dim newTab As New Table(db, "NewTab") 'Add Columns in table Dim idCol As New Column(newTab, "ID") idCol.DataType = DataType.Int idCol.Nullable = False idCol.Identity = True idCol.IdentitySeed = 1 idCol.IdentityIncrement = 1 Dim nameCol As New Column(newTab, "Name") nameCol.DataType = DataType.VarChar(20) nameCol.Nullable = False newTab.Columns.Add(idCol) newTab.Columns.Add(nameCol) l1.Text="Table is Created" newTab.Create() and I got error Server Error in '/asp/DataCon' Application. -------------------------------------------------------------------------------- Property DefaultSchema is not available for Database '[MyDB]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: Microsoft.SqlServer.Management.Smo.PropertyCannotB eRetrievedException: Property DefaultSchema is not available for Database '[MyDB]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights. Source Error: Line 24: Line 25: 'Create Table Line 26: Dim newTab As New Table(db, "NewTab") Line 27: Line 28: 'Add Columns in table I have granted all permission of my database[MyDB] except connect. what can I do for create table. |
| All times are GMT -4. The time now is 10:33 pm. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC