|
Hi all, i have the following...
SELECT Distinct DocGroup.Owner , DocGroup1.Document_Group as Grp1, DocGroup2.Document_Group as Grp2,<br />
DocGroup3.Document_Group as Grp3, DocGroup4.Document_Group as Grp4,<br />
DocGroup5.Document_Group as Grp5, DocGroup6.Document_Group as Grp6,<br />
DocGroup7.Document_Group as Grp7, DocGroup8.Document_Group as Grp8,<br />
DocGroup9.Document_Group as Grp9, DocGroup10.Document_Group as Grp10,<br />
DocGroup11.Document_Group as Grp11, DocGroup12.Document_Group as Grp12,<br />
DocGroup13.Document_Group as Grp13, DocGroup14.Document_Group as Grp14,<br />
DocGroup15.Document_Group as Grp15, DocGroup16.Document_Group as Grp16<br />
FROM Document DocGroup LEFT JOIN Document DocGroup1<br />
ON DocGroup.Owner = DocGroup1.Owner AND DocGroup1.Document_Group = '1' LEFT JOIN Document DocGroup2<br />
ON DocGroup.Owner = DocGroup2.Owner AND DocGroup2.Document_Group = '2' LEFT JOIN Document DocGroup3<br />
ON DocGroup.Owner = DocGroup3.Owner AND DocGroup3.Document_Group = '3' LEFT JOIN Document DocGroup4<br />
ON DocGroup.Owner = DocGroup4.Owner AND DocGroup4.Document_Group = '4' LEFT JOIN Document DocGroup5<br />
ON DocGroup.Owner = DocGroup5.Owner AND DocGroup5.Document_Group = '5' LEFT JOIN Document DocGroup6<br />
ON DocGroup.Owner = DocGroup6.Owner AND DocGroup6.Document_Group = '6' LEFT JOIN Document DocGroup7<br />
ON DocGroup.Owner = DocGroup7.Owner AND DocGroup7.Document_Group = '7' LEFT JOIN Document DocGroup8<br />
ON DocGroup.Owner = DocGroup8.Owner AND DocGroup8.Document_Group = '8' LEFT JOIN Document DocGroup9<br />
ON DocGroup.Owner = DocGroup9.Owner AND DocGroup9.Document_Group = '9' LEFT JOIN Document DocGroup10<br />
ON DocGroup.Owner = DocGroup10.Owner AND DocGroup10.Document_Group = '10' LEFT JOIN Document DocGroup11<br />
ON DocGroup.Owner = DocGroup11.Owner AND DocGroup11.Document_Group = '11' LEFT JOIN Document DocGroup12<br />
ON DocGroup.Owner = DocGroup12.Owner AND DocGroup12.Document_Group = '12' LEFT JOIN Document DocGroup13<br />
ON DocGroup.Owner = DocGroup13.Owner AND DocGroup13.Document_Group = '13' LEFT JOIN Document DocGroup14<br />
ON DocGroup.Owner = DocGroup14.Owner AND DocGroup14.Document_Group = '14' LEFT JOIN Document DocGroup15<br />
ON DocGroup.Owner = DocGroup15.Owner AND DocGroup15.Document_Group = '15' LEFT JOIN Document DocGroup16<br />
ON DocGroup.Owner = DocGroup16.Owner AND DocGroup16.Document_Group = '16'
This is taking 4ever to load... would it help to put this in a pivot table?? i have been trying but i cant seem to do it (i only have an example of where count is used in a pivot table??)
Thank you in advance.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
modified on Wednesday, December 05, 2007 7:35:23 AM
|
|
|
|
|
The following connection string works for me:
"Data Source=.\\SQLEXPRESS;database=master;Integrated Security=True;Connect Timeout=5;User Instance=True"
However, when I try to navigate to any other database on the SQLEXPRESS server, for instance MyCompany, it doesn't work. The database is located in a directory that is one back from where the master directory is located, and I don't know how to direct it there.
master is located in SQLEXPRESS\Databases\System Databases\
But the database I want is located in SQLEXPRESS\Databases\
How would I accomplish that? Nothing I do seems to work. I've tried the |DataDirectory| thing I've found on many websites, but that doesn't work... because I'm not trying to point to a database on the computer I'm using, I'm trying to point to one on the SQL Server.
modified on Wednesday, December 05, 2007 1:30:30 AM
|
|
|
|
|
Attach the database in your instance of SQL Express, then change the database name in your connection string from 'master' to the name of your database.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks for the reply Paul. I have the file attached to my instance of SQL express, but it doesn't seem to work.
C# keeps giving me an error exception that I catch and read the contents of when I do that.
Cannot open database "mycompany" requested by the login. The login failed.
Login failed for user 'BlahBlah\BlahBlah'.
I think it's because when I attach to the instance of SQL express, it isn't attaching the database in the same location as the master and other system databases are in... as noted in my initial post.
|
|
|
|
|
You're confused by how Management Studio is presenting the information. The master database and the other system databases are placed under System Databases in the tree to keep them out of the way of your user databases, to both reduce noise and to slightly reduce the risk of accidental damage. As far as the server itself is concerned there is no separation, there is only a single namespace for all databases.
If you cannot log on to a database that is loaded into SQL Server but can log on to other databases, it typically means that you don't have permissions in that database. I haven't got space or time for a full treatment here, but basically your Windows user account or SQL Server logon has to have a logon to the server (under SQLEXPRESS\Security\Logons) and then a user account has to be mapped (under SQLEXPRESS\Databases\yourdb\Security\Users). The exact permissions for what you can do depends on the server roles that the logon is a member of, and the database roles that the user is a member of.
I also note you're using User Instances. This effectively creates a private instance of SQL Server just for this user. My understanding is that you cannot then see databases loaded by the parent instance, only ones loaded into the private instance using AttachDBFilename. I suspect that you want to remove the User Instance parameter from the connection string.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Mike... I already had all the permissions set up. Apparently the last thing you said about the user instances, that worked. I turned it to false and I connected up to the database. THANK YOU!
You are an amazing help, and I don't know why I didn't think of that before. I'm trying to learn C# and databases currently to supplement my C# studies, and this was something that was bugging me.
Much appreciated! Sometimes the most frustrating problems can be caused by the most simple of mistakes.
|
|
|
|
|
hello every1;
i have problem in connecting access with java
heres my code :
public class ElectronicCookBook extends javax.swing.JFrame {
private String url;
private Connection connect;
/** Creates new form ElectronicCookBook */
public ElectronicCookBook() {
initComponents();
try{
url="jdbc:odbc:cook.mdb";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
try {
connect=DriverManager.getConnection(url,"","");
} catch (SQLException ex) {
ex.printStackTrace();
System.out.println(ex.getMessage());
}
}catch(ClassNotFoundException ex){
ex.printStackTrace();
}
}
code throws following exception :
database name not found or no default driver specified.
i am a newer and working in netbeans
my project is a desktop application
please help me out
thanks all
|
|
|
|
|
These forums are primarily for Microsoft-based technologies. You would be better off asking your question on a Java forum.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I need help w/ setting DataTable.DataType of nvarchar
System.Nvarchar does not exist... does anyone know how to do this?
bulkCopy.WriteToServer throws an exception because it cannot put a string into nvarchar...
dc.DataType = System.Type.GetType("System.Nvarchar");
private void StartImport()
{
Stopwatch sw = new Stopwatch();
sw.Start();
SqlBulkCopy bulkCopy = new SqlBulkCopy("Server=ServerName;Database=test;Trusted_Connection=True;", SqlBulkCopyOptions.TableLock);
bulkCopy.DestinationTableName = "dbo.testSQLBulkCopy";
bulkCopy.WriteToServer(CreateDataTableFromFile());
sw.Stop();
txtResult.Text = (sw.ElapsedMilliseconds/1000.00).ToString();
}
private DataTable CreateDataTableFromFile()
{
DataTable dt = new DataTable();
DataColumn dc;
DataRow dr;
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.Int32");
dc.ColumnName = "c1";
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.Int32");
dc.ColumnName = "c2";
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.Int32");
dc.ColumnName = "c3";
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.Int32");
dc.ColumnName = "c4";
dc.Unique = false;
dt.Columns.Add(dc);
StreamReader sr = new StreamReader(@"d:\work\test.txt");
string input;
while ((input = sr.ReadLine()) != null)
{
string[] s = input.Split(new char[] { '|' });
dr = dt.NewRow();
dr["c1"] = s[0];
dr["c2"] = s[1];
dr["c3"] = s[2];
dr["c4"] = s[3];
dt.Rows.Add(dr);
}
sr.Close();
return dt;
}
|
|
|
|
|
Firstly, to get a type object for a built-in type is more simply expressed as just:
typeof( int ) I don't see why using typeof(string) wouldn't work for your requirement, but if you do have trouble, consider using System.Data.SqlTypes.SqlString instead.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Hi all,
I have populated treeview control based on logged in user's credentials under forms authentication. I have used cookies management. The next step is how to render the populated report on reportviewer control. I have tried with following code
ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://servername/Reports");
ReportViewer1.ServerReport.ReportPath = "/" + Request["Path"];
Can any one help me please ?
|
|
|
|
|
MSinha wrote: Can any one help me please ?
With what? You haven't stated what your problem is. What is wrong with the code you have posted? Are you getting an error?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Problem is with rendering of the report from tree view nodes to reportviewer control. I gets this error:
The request failed with the error message: -- <html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="/ReportServer/logon.aspx?ReturnUrl=%2fReportServer%2fReportExecution2005.asmx">here</a>.</h2> </body></html> --.
|
|
|
|
|
Hi, I am trying to update my local Access DB with data retrieved from my Sybase server. I use this ADO query under the Access ADO connection:
"SELECT * INTO LocalTbl FROM OPENROWSET('ODBC','DATABASE=DB';'UID=USER';'PWD=PWD';'DSN=SYBASE_DSN','SELECT T1.M_SE_LABEL AS BASKET_NAME,T2.M_SE_BSK_COM AS MX_SECURITY, T2.M_SE_BSK_WEI AS WEIGHT FROM SE_MKTOP_DBF T1 ,SE_BKC_DBF T2 WHERE T1.M_SE_INUM = T2.M_SE_INUM AND T2.M_SE_RTYPE = 'INSTR'')"
but get Error number -2147217900 (Syntax error ner FROM)
Can anybody help me with this?
Thanks in advance
|
|
|
|
|
does the Openrowset wrok in your computer?
CodeProject,Your Code, Your Porject!
|
|
|
|
|
Sure, I´ve tried with two Access DBs.
The thing is that I am not sure OPENDATASOURCE/OPENROWSET works with ODBC connections (wonder if someone can clear this up to me). I think I should use OLEDB instead, but have no OLEDB driver installed for Sybase.
|
|
|
|
|
Sorry, I'm a liar. I checked with two Access connections and I still get the same Error (-2147217900). Any idea?
Thanks in advace
|
|
|
|
|
How to create a stored procedure in MySql using:
1.create query
2.insert query
|
|
|
|
|
Have you tried reading the documentation[^]?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi all,
declare @str1 varchar(500)
declare @str2 varchar(500)
declare @str3 varchar(500)
declare @str4 varchar(500)
select @str1=ud_id from cm_tb_002 where username='admin';
select @str3=role_id from cm_tb_012 where tb012_id=@str1;
select @str4=tb001_id from cm_tb_001 where menu_activ = 1 and child_lvl = 0 and [15]='1';
select tb001_id from cm_tb_001 where menu_prnt=@str4;
Here i want to pass @str3 to a this query
select @str4=tb001_id from cm_tb_001 where menu_activ = 1 and child_lvl = 0 and @str3='1';
but the @str3 column is an bigint column. ex. 15 i.e column name
In sql sever this value is storing as [15] as column name. Now i want to
pass this value to this query
select @str4=tb001_id from cm_tb_001 where menu_activ = 1 and child_lvl = 0 and @str3='1';
Please help me on this.
i want to join this group
|
|
|
|
|
You would need to construct your SQL statement as a string and execute it using the EXEC statement.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hai all
In my table i have some records with serial number
ex:
1
2
3
4
5.
if i delete 3 means 4 should be decremented as 3 and 5 should be decremented as 4.
Plse give me a logic to do this.
Thanks in advance.
With regrds
Lijo Rajan
|
|
|
|
|
Lijo Rajan wrote: Plse give me a logic to do this.
What have you tried? Show that you have made a serious attempt to solve the problem and I'll help you.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I dont know the logic.I am requesting u to give me logic or sql statement to do this
|
|
|
|
|
Lijo Rajan wrote: I dont know the logic.I am requesting u to give me logic or sql statement to do this
I don't give code to people, especially when they haven't demonstrated that they have tried to solve the problem themselves.
I'll give you a hint though - use an UPDATE query to decrement all serial no. values greater than the one being deleted. Your biog states that you are a professional software engineer, so you should be able to figure out how to implement this.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|