dear all
I got the follwoing error while trying to create database user
The role ''db_owner'' does not exist in the current database.
Changed database context to 'try2'.
here the code
[CODE]
string query = string.Format(" CREATE DATABASE [{0}]", textBox5.Text.T oString());
string query1 = string.Format(" CREATE LOGIN [{0}] WITH PASSWORD...
User Profile
Collapse
-
sql parmeter problem
Dear all I got the following error while I trying to create database
Incorrect syntax near '@db'.
here is the code
[CODE]
string query = " CREATE DATABASE '@db' ON PRIMARY (NAME = @db FILENAME ='@file') ";
SqlConnection temp = new SqlConnection(@ "Data Source=.\SQLEXP RESS;Database = master;Integrat ed Security=True;C onnect Timeout=30;User Instance=True;" );... -
i corrected the code ...and i got the following error message
Dear all while i was trying to access sql server i got that problem
Login failed for user ''. The user is not associated with a trusted SQL Server connection
the code is as the following
string connectionstr = string.Format(@ "Data Source={0},1433 ;Initial Catalog=maindat abase;Integrate d Security=True", listBox1.Select edItem.ToString ());... -
sql network
Dear all
I got that error when I was trying to connect to a server over IP
Object reference not set to an instance of an object.
the code for that
[CODE]
string connectionstr = string.Format(@ "Data Source=10.192.4 .154,1433;Initi al Catalog=maindat abase;Integrate d Security=True", listBox1.Select edItem.ToString ());
SqlConnection connection = new SqlConnection() ;... -
database security
Dear all
I am trying to create database one the sql server and this database is protected, so that the user who has the password has access to that database...not more
how to make that..any ideas? -
server database
if I create username and password to the sql server through these statment
[CODE]
USE <database name> GO
CREATE USER <new user name> FOR LOGIN <login name> ; GO
[\CODE]
what will be the connection string on that case..I mean the connection string u have to mention database...will it be the master datatbase..so the connection string... -
set password
Dear all
can I set a password for each mdf sql database file...or the password for the whole server..
I used the follwoing string
string query = " CREATE DATABASE " + textBox6.Text.T oString() + " ON PRIMARY "
+ " (NAME = " + textBox6.Text.T oString() + ", "
+ " FILENAME... -
createing database problem
Dear all while I am trying to create database..I got these error
An attempt to attach an auto-named database for file C:\Documents and Settings\John Khalil\Desktop\ s.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
here the code to create the database
...Code:SqlConnection temp = new SqlConnection(@"Data Source=.\SQLEXPRESS;Database = master;Integrated
-
-
dataset
I would like to know...which is better to insert the data in sql database table
to fill the dataset then updata the database one shot
or make direct call for the database withe required data!!
Note: I use c# to fill and load the data -
parent row
i have two table...one table is the building names and the other one the floors name at each buliding and so based on that the rows in building table is the parent row for the rows in sec. table floors...so is it possible to insert data in the floor table and mention the parent row in building table....note that I make table relation between the two tables building or floor table....what is the sql statement for these insertion...and can I use with... -
but I create the connection string in one class and the methods which deal with the sql database on other class...ur solution available if both on the same class..Leave a comment:
-
ok I tried the following solution however i got error
ok
i tried the following solution
[code=c#]
class sqldatabase
{
public static String connectionStrin g;
SqlConnection connection = new SqlConnection(c onnectionString );
}
[/code]
in my application I made the following
[code=c#]
if (open.ShowDialo g() == DialogResult.OK )
{...Leave a comment:
-
How to change connection string for database class?
Dear all
i wrote one class to deal with sql database to insert and read data from that class only...and based on that one of the parmeters or the class is the sqlconnection
SqlConnection connection = new SqlConnection(@ "Data Source=.\SQLEXP RESS;AttachDbFi lename= {0};Integrated Security=True;C onnect Timeout=30;User Instance=True") ;
so the connection string is defined indepented of the class objects... -
mac address
Code:public static NDIS_802_3_ADDRESS StrToByteArray(string str) { ASCIIEncoding encoding = new ASCIIEncoding(); byte[] m = encoding.GetBytes(str); NDIS_802_3_ADDRESS mac = new NDIS_802_3_ADDRESS(m); return mac; }
U use these method in order to change string to mac address, however the output of that is fixed value 30-30-2D-32-31-2D,... -
multi methods
is it possible that one class has multi methods and each method return a value ? because while I am trying to create a class with two methods each one return bool value I got the error
Error 24 'WiPosGUICSharp .sqldatabase.ex port(System.Col lections.Generi c.List<string>) ': not all code paths return a value D:\master\WIPos \graphic\GUI\Wi PosGUICSharp\sq ldatabase.cs 103 23 WiPosGUICSharp -
classes
dear all
I wrote a class called "sqldatabas e" and this class has variable caleld Buliding
and from other class I tried to insert the string inside buliding variable
and I got these message
"Object reference not set to an instance of an object"
here the code
public partial class Import : Form
{
sqldatabase a = null;
... -
-
this solution doesn't work..in adition I want to insert zero valueLeave a comment:
-
insert new columes
dear all
if I have table has three columes already and each have some values inside already
and I want to add 6 columes extra for that table and put values 0 inside each of the new columes..
I used the sql query
ALTER TABLE mytable ADD columename int NULL
but these create columes with null values but I want to create with 0 values...
No activity results to display
Show More
Leave a comment: