|
I believe I will not be able to use "\" in my strings
I get compilation errors if I use:
string cs = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Y:\csv\;Extended Properties='text;HDR=Yes;FMT=Delimited'";
regards
|
|
|
|
|
The slash character is used as part of an escape sequence. e.g. \n
So.... Either escape the slashes
string filename= "C:\\MyFile.txt"; or put an @ symbol in front of the quote (which indicates you don't want any characters escaped)
string filename = @"C:\MyFile.txt"
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Hi Guys,
I'm thinking about using SQL2005 for storing various documents, images and binary files. Therefore, the database size will grow quite large.
There won't be many rows in the database tables. And let's assume I design my database well The large database size is only due to the binary files.
Does anyone know if there will be an impact on performance as the database size grows very large (to, say, 10s of gigabytes).
Thanks in advance!
Visit Riverside Internet[^]
Visit Mike Puddephat Online[^]
|
|
|
|
|
Mike Puddephat wrote: How Large Can SQL Server 2005 Database Be?
The maximum size is just over 1 billion terrabytes - Is that large enough? (ref: Enterprise Edition)
Mike Puddephat wrote: Does anyone know if there will be an impact on performance as the database size grows very large (to, say, 10s of gigabytes).
I don't see a great problem with that. The largest database I use on a day-to-day basis is 150Gb (growing at around 50Gb per year)
The only issue is that the hardware that supports it has to be capable as well. As you won't have many rows, just lots of binary data then I guess it won't need to do much processing, just need lots of fast disks.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
|
My workplace has Microsoft Windows Small Business Edition Premium Edition (includes Microsoft SQL Server 2000).
At home, on a Windows XP Pro with SP2 machine, I code my software with Microsoft Visual Studio 2005, Microsoft SQL Server 2005 (client-end cause Enterprise Manager is not supported on Windows XP Pro) and Microsoft SQL Server Express Edition.
Right now, all my ASP.NET pages links to a database DataSource=.\SQLExpress.
I am wondering if I were to testrun this small software I'm coding in my office's Windows SBS Server (with SQL 2000), will it run since it's coded in SQLExpress?
-- modified at 5:10 Friday 17th March, 2006
|
|
|
|
|
tanpanjang wrote: I am wondering if I were to testrun this small software I'm coding in my office's Windows SBS Server (with SQL 2000), will it run since it's coded in SQLExpress?
It depends if you are using any of the new features. If you stick to things that are available in SQL Server 2000 it will probably work on both.
However, since your business is using SBS then it will be the only server, if I remember correctly, because SBS won't allow other servers to exist on the network (part of the licencing terms - that's why it is so cheap). The conclucsion of that statement is that your business is running of the SBS and to test code on a production/live server is generally not a good idea. For a small business the interuption to service if anything went wrong may be devastating.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Can anyone please help me in my problem . i want to store the result of the exec (@sqlQuery) into a variable @TempColumnValue of type nvarchar(100)
Note: In my case exec (@sqlQuery) always returns a single value
example:
declare @sqlquery varchar(100)
declare @TempColumnValue nvarchar(50)
set @sqlQuery = 'select @TempColumnValue = firstname from usertable where userid=1'
exec (@sqlQuery)
but this gives error 'Must declare the scalar variable "@TempColumnValue"'.
Is there any other way to get it done
waiting ur response!
thanx
|
|
|
|
|
Yes, but it is an awkward solution.
You need to insert the result of the EXEC(@sqlQuery) into a temporary table, then get the value from the table
INSERT #MyTempTable EXEC(@sqlQuery);
SELECT @TempColumnValue = MyTempColumn FROM #MyTempTable
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
hi colinmackay
thanx for ur support1
sandeep
|
|
|
|
|
I am looking for suggestions on how to handle customer defined data. I currently have a database with a fixed number of rows for my standard data. However, I have the need to allow a customer to be able to add additional fields of data to the database for their own data. The three methods I have come up with so far are:
1. Have the ability to alter the table via SQL ALTER to add new fields as needed. I dont really like this method because the app will be modifying a database structure.
2. Create X number of extra fields and map the new fields/data to the already reserved data fields. For eample the customer adds field1 then the app maps field1 to AddField1 that already exists in the database. However, you would only be able to add as many fields as there are existing reserved fields.
3. Add a table that contains a id, field, and value column. For each record that uses the extended field, a new record will be inserted into this table that will contain a key id back to the main record, a field name, and the value for the field. This would allow an endless number of extra fields to be added.
Any suggestions/comments/examples would be greatly appreciated.
|
|
|
|
|
The third solution is best. i have implemented it, in some problems and the project are working fine.
|
|
|
|
|
Hi,
I'm new to Visual C++ database programing.
I'm using ODBC cursor to connect to an Access database *.mdb file.
retcode = SQLSetStmtAttr(hstmt1, SQL_ATTR_CURSOR_SCROLLABLE,SQLPOINTER)SQL_SCROLLABLE, SQL_IS_INTEGER);
I used the above line of code to make the cursor scrollable to I can do SQLFetchScroll to go backward and forward.
However I got the following error message: Optional feature not implemented.
Please help.
Thank you very much
nhuythanh@gmail.com
|
|
|
|
|
I am running Windows XP Pro with Service Pack 2, Visual Studio 2005, Microsoft SQL Server 2005 and Microsoft SQL Server Express Edition.
I have a file called EmployeeDirectoryOle.aspx in which I used a Repeater Control to display all the Employee records within the Employee table of the pfsnicom.mdb Microsoft Access file. I dont have a problem displaying records with the Repeater Control.
Another file, the EmployeeDirectorySql.aspx, contains the same codes (but different Namespace of course) connects and reads from SQL Database File. Whenever, I test query SELECT * FROM Employees under my 'Configure Data Source' window, it's fine. However, when I try to run this file, I get the error below:
" An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
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: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
How do I resolve this problem?
|
|
|
|
|
tanpanjang wrote: How do I resolve this problem?
If your SQL Server 2005 is installed on a separate machine then allow TCP/IP connections.
Open the SQL Server 2005 Surface Area Configuration. Navigate to the instance of SQL Server that you are interested in. In Database Engine click on Connections and select Allow Remote connections.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Is my correct?
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<head>
<title>The Dorknozzle.com Intranet Site</title>
<script runat="server" language="C#">
void Page_Load(){
SqlConnection objConn;
SqlCommand objCmd;
SqlDataReader objRdr;
objConn = new SqlConnection(
"Server=COMPUTERNAME\\NETSDK;" +
"Database=pfsnicom.mdf");
objCmd = new SqlCommand("SELECT * FROM Employees", objConn);
objConn.Open();
objRdr = objCmd.ExecuteReader();
rpcEmpDirectory.DataSource = objRdr;
rpcEmpDirectory.DataBind();
objRdr.Close();
objConn.Close();
}
|
|
|
|
|
tanpanjang wrote: objConn = new SqlConnection(
"Server=COMPUTERNAME\\NETSDK;" +
"Database=pfsnicom.mdf");
Don't specify the name of the MDF file. Specify the name of the database - SQL Server should already know about it.
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Colin Angus Mackay wrote: Don't specify the name of the MDF file. Specify the name of the database - SQL Server should already know about it.
Still doesnt work... Changed the .mdf, removed the NETSDK, put back the NETSDK, etc. Still the same error.
There are a lot of people who ended up doing things wrongly, even if they had the best of intentions at the beginning. Then again, there is no guarantee the words they said were conveyed as they originally were intended to be. That's because those on the receiving end only hear what they want to hear.
|
|
|
|
|
Colin Angus Mackay wrote: If your SQL Server 2005 is installed on a separate machine then allow TCP/IP connections.
Open the SQL Server 2005 Surface Area Configuration. Navigate to the instance of SQL Server that you are interested in. In Database Engine click on Connections and select Allow Remote connections.
I tried but it didnt work.
SQL Server 2005 Surface Area Configuration --> Services and Connections --> (Under SQLEXPRESS -> DATABASE ENGINE -> REMOTE CONNECTIONS) Local and remote connections --> Using both TCP/IP and named pipes --> Apply --> OK.
Service --> Stop --> Start --> Apply --> OK.
Could it possibly be something wrong with my script? rpcEmpDirectory is my Repeater control.
|
|
|
|
|
I am having some difficulties getting my report to work properly. I am connected to an Access database. If i have all my links as inner joins then the report will show up but incorrectly. I asked another person about the problem and he said to change to outer left joins. I did that and i get "Query Engine Error" and it shows the path to the report. I basically need to show some information about a customer and their transactions. The problem is that when there are no transactions then no customer information shows up at all. In this case i would like to show the customer name, id, phone number etc without the transactions. The user would have to be able to specify which customers to show either by specifing a range of last names or a range of Customer ID's. Any help would be appreciated.
|
|
|
|
|
hi,
i want to fetch a data from the table which i have to give dynamically in my stored procedure
The thing I m stucked on is
---declaring a variable to hold table name
declare @TableName nvarchar(50)
--here i m setting the tablename for example my actual situation it will come from . result of queries prior to this
@Tablename='Annotationproperty'
--Select particular column from particular table for this row
select propertyID from @TableName where UserID=1
It gives an error that Must declare the table variable "@TableName"
So how I can give a dynamic table name in my sql query or is there some alternate way for this.
waiting ur replies
thanx
sandeep
|
|
|
|
|
As you have found, you cannot use a parameter as a table name. You need to build a dynamic SQL string and execute it.
You can do this:
DECLARE @sql nvarchar(4000);
SET @sql = 'SELECT * FROM ['+@TableName+']';
EXEC(@aSQLstring)
So, you need to build a string containing the whole SQL Statement and then execute it. However, be aware that this is prone to mallicious attack if you are not careful. Always verify that the contents of @TableName actually contain the name of a table in your database before performing an EXEC(@sql) by doing something like this
IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @TableName)
BEGIN
-- Put your code here
END
ELSE
BEGIN
-- Put your error handling code here. The table does not exist!
END
Finally, declaring @TableName as varchar(50) is potentially going to cause errors. If you are holding the table name in the variable declare it at sysname or nvarchar(128), e.g.
DECLARE @TableName sysname
Does this help?
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
hi
Colin Angus Mackay
Can u please help me in my other problem too. I m doing as u told , now i want to store the result of the exec (@sqlQuery) into a variable @TempColumnValue of type nvarchar(100)
Note: In my case exec (@sqlQuery) always returns a single value
example:
declare @sqlquery varchar(100)
declare @TempColumnValue nvarchar(50)
set @sqlQuery = 'select @TempColumnValue = firstname from usertable where userid=1'
exec (@sqlQuery)
but this gives error 'Must declare the scalar variable "@TempColumnValue"'.
Is there any other way to get it done
waiting ur response!
thanx
sandeep
|
|
|
|
|
Yes, but it is an awkward solution.
You need to insert the result of the EXEC(@sqlQuery) into a temporary table, then get the value from the table
INSERT #MyTempTable EXEC(@sqlQuery);
SELECT @TempColumnValue = MyTempColumn FROM #MyTempTable
ColinMackay.net
Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?
|
|
|
|
|
Hi.
I am jawwad Khan From Pakistan.
I am using visual basic.NET 2005
While programming the database we were used to use the Filter property of the Recordset to select the records satisfying certain criteria.
i.e
dim rs as recordset<br />
.....<br />
......<br />
rs.filter="CustomerID=" & textbox1.text
suppose we have a datagridview showing data from a certain dataset. How can we filter the dataset and show the data in the datagrid.
i am not using the datasource or any binding control.
i want every thing to be done through code.
thank you
|
|
|
|