Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

query error

$
0
0

i am login ,i want create table with use username , but i see this error.

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; public partial class Home : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Session["userName"]= User.Identity.Name; string u = Session["userName"].ToString(); if (IsPostBack==false && u!="Admin") {

   SqlConnection connect = new SqlConnection();
            connect.ConnectionString = "Data Source=.;Initial Catalog=AspNetSqlProvider;Integrated Security=True";
            //string idSelect=string.Format("select UserId from aspnet_Users where UserName = '{0}'",u);
            string query1 = string.Format("CREATE TABLE {0}.Profile(ID uniqueidentifier not null,name nvarchar(20) not null,about text null,pic image null) ", u);
            SqlCommand cmd = new SqlCommand(query1, connect);
            cmd.Connection.Open();
            cmd.ExecuteNonQuery();
            cmd.Connection.Close();

//AND CREATE TABLE {0}.Friend (ID uniqueidentifier not null,name nvarchar(20) not null,popular bit null) AND CREATE TABLE {0}.Post(ID_Post int not null,sendItem text null,Img image null) } else { Label1.Text = "ok"; } } }

Server Error in '/Personal' Application.

The specified schema name "sobhan" either does not exist or you do not have permission to use it.

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: System.Data.SqlClient.SqlException: The specified schema name "sobhan" either does not exist or you do not have permission to use it.


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>