|
Pius__X wrote: Is it posible access to database whitout DataSet and DateReader and use open connectivity or there are only thease two ability?
Unless the database vendor provides it the only access method is via the DataReader .
To clear up some misunderstandings in your statement:
There are no other access methods. The DataSet has no database connectivity at all. The DataAdapter uses a DataReader to extract data from the database and put it in a DataSet .
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
|
hi i'm very novice in .net.
can any body tell me how can i read the field of database to make the login page.i have to connect the MYSql with vs.net 2005.
if could then please provide the appropriat code or detail steps.
thanx
Aavesh
|
|
|
|
|
Hello !
I want through a stored procedure to import a table from a CSV file.
I don't want to use bcp or other utilities, it needs to be through the stored procedure.
That means through SQL commands.
What I actually do is I build a CSV file in C# and I don't want to build a dataset and to fill it with data and to move it to SQL Server. I want that it will be done through the SQL Server directly.
Thanks,
Clint
|
|
|
|
|
Why not BCP from a stored proc using the xp_cmdshell
|
|
|
|
|
http://searchvb.techtarget.com/tip/1,289483,sid8_gci808621,00.html?bucket=ETA
|
|
|
|
|
i tried code from
http://support.microsoft.com/default.aspx?scid=kb;en-us;312839#XSLTH4156121122120121120120
As we are using window2003 we need to use CDOSYS code from given URL.
Its working on our side.
But giving problem on client side.
Can any one help me this?????
http://support.microsoft.com/default.aspx?scid=kb;en-us;312839#XSLTH4156121122120121120120
|
|
|
|
|
I am using Microsoft Patterns and Practices Enterprise Library Data Access Block. I have called a function which returns an object of type IDataReader. It has only single row in it.
I am writing this code
IDataReader dr =db.ExecuteReader(cmd);
string CityName = dr.GetValue(0).ToString();
On running this code I am getting the exception as
InvalidOperationException: Invalid attempt to read when no data is present.]
System.Data.SqlClient.SqlDataReader.PrepareRecord(Int32 i)
System.Data.SqlClient.SqlDataReader.GetValue(Int32 i)
But when I add two lines of code in it which has nothing to do with the running code, I don't get any exception. The code is as
IDataReader dr =db.ExecuteReader(cmd);
if (dr.Read()==true)//yaha kuch gadbad hai
{
int mkio =0;
}
string CityName = dr.GetValue(0).ToString();
Why this problem is happening and why it is not occuring when i add code which has nothing to do with the results.
Thanks,
Sandy Sekhon
|
|
|
|
|
MudkiSekhon wrote: But when I add two lines of code in it which has nothing to do with the running code, I don't get any exception
This is incorrect. The line code dr.Read() had a lot to do with running the code correctly. You MUST read the first row into the Data Reader before you can access it.
You don't need the rest of the if statement, however.
MudkiSekhon wrote: Why this problem is happening and why it is not occuring when i add code which has nothing to do with the results.
It is happening because all you have is a Data Reader. You need to tell it what you want it to do with the data. In this case, read the first (and only) row of data. It will make no assumptions on what you want to do with it so it won't advance to any rows of data until you tell it to. This is the correct behaviour. The code you added does have something to do with the results - so the statement that it "has nothing to do with the results" is erroneous.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
hey guyz,
i am developiung an application
for that i need to know the architecture of oracle 9i
can some body suggest me sites fromn where i can download "FREE" PDF'S OR free online tutorilals
|
|
|
|
|
I have a copy of SQL Server 2005, but it wont install... it keeps saying there is a version already on my computer. I downloaded some trials, as well as MySql, but i deleted all of those... unless the regs were left behind. I dont supposed anyone knows the keys so i can look (or most likely a link to a page with them.)... i also installed Visual Studio 2005, which had SQL Server Mobile, if that is possibly interfering... Either way, when i try to use it by going into access and making a New Database Project, and set up UserName/Pass and try to connect to my local machine, it always come back with a ton of errors... all i want is to just use databases in VB2005, why is it to annoyingly hard... im considering just formating and going from scratch. lol... maybe theres something im missing... This is why i call on you wonderful sage of all that is SQL, please help a desperate noobie.
"Love, Life and Option Explicit"
|
|
|
|
|
You may ge this error if you have any of the .NET beta(s) installed on your systems as well as any of the SQL beta progs installed. Check to see if you have uninstalled them.
My Programming Library
/* You are not expected to understand this */
-- modified at 1:12 Wednesday 5th April, 2006
|
|
|
|
|
no betas at all.. only what came with the official vs2005
"Love, Life and Option Explicit"
|
|
|
|
|
I seem to remember you posting the following:
I downloaded some trials, as well as MySql, but
Trials? But they were not betas...you mean the 180 day trials?
Visual Studio and SQL are dead. Long live Visual Studio and SQL!
|
|
|
|
|
yes, they were the trials. i only had them for a few hours, and ended up uninstalling them. now that i have a bit more time, im gonna try tinkering with it, using the MSDN library's SQL section.
"Love, Life and Option Explicit"
|
|
|
|
|
And thus i discover the folly... SQL 2005 is not compatible with XP home.. i would need XP proffessional.. so i installed Express 2005, just so i could get same basic work done for now... thanks you for your addistance anyway. much appriciated.
"Love, Life and Option Explicit"
|
|
|
|
|
Hi All,
I need to count the records of a table, but the table name is in a reference. Some thing like following.
declare @aa bigint
declare @tbl varchar(200)
set @tbl = 'mydb..myTable';
select @aa = count(*) from @tbl;
print @aa;
GO
It doesn't work right now and the message is "@tbl need to be a table". Even if @tbl is declared as table using "declare @tbl table", it still doesn't work. Any suggestions will be greatly appreciated.
Kevin
|
|
|
|
|
This will return the count in a record - any use?
declare @aa bigint
declare @tbl varchar(200)
set @tbl = 'Orders';
exec('select count(*) from ' + @tbl)
|
|
|
|
|
Hi McCodeJunky,
Many thanks for your quick response.
This is part of a procedure. I need to keep the count in @aa so I may use it later. How? Thanks.
Kevin
|
|
|
|
|
This does what you expect:
declare @tbl varchar(200)<br />
set @tbl = 'tblTest';<br />
EXEC('declare @aa bigint; select @aa = count(*) from ' + @tbl + '; print @aa;')<br />
GO
But, it is dangerous to use this method if this code is in a stored procedure. Anyone could call your procedure and execute their code on your server. You can safeguard against this by doing something similar to this:
declare @tbl varchar(200)<br />
set @tbl = 'myTable';<br />
if len(@tbl) > 20 <br />
begin<br />
print 'Cannot process---invalid table name length'<br />
end<br />
else<br />
begin<br />
EXEC('declare @aa bigint; select @aa = count(*) from ' + @tbl + '; print @aa;')<br />
end<br />
GO
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
Hi EricDV,
Many thanks for your suggestion. You have a very good point here and I'll use it when I finalize my codes.
How should I modify your codes so I can use @aa later on? Thanks.
Kevin
|
|
|
|
|
kevin127 wrote: How should I modify your codes so I can use @aa later on?
You would need to use it within the EXEC(";...") line. The variable only has a scope for as long as the EXEC() statement is executing. You could concatenate your code on the end, using the semi-colon delimiter to end each line. This isn't pretty, but it works. There may be a better way that I'm not aware of.
--SQL Server Books Online--
Changes in database context last only until the end of the EXECUTE statement. For example, after the EXEC in this example, the database context is master:
USE master EXEC ("USE pubs") SELECT * FROM authors
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
I have a marketing leads table that I created. The Primay key is a value that is automatically seeded when a new record is created. In my C# app I was showing the new value in the databound field. This was when I had the adapter, connector and dataset from the toolbar. However I remeved these from the app and programmed them in. What do I need to do to show the value when a user clicks the new button.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Got a question.
I need to create a cluster of SQL to support more users. What's the best way as I want all computers to have the same IP using NLB. Can I put the database in a SAN box and each server load that database? Can only one SQL open that file or multiple servers can use the same database in a fisical location?
Otherwise can I use Replication and wherever I make that UPDATE will send the changes to the other computers?
Please let me know the best way to do this
Cheers
Al
|
|
|
|
|
It really doesn't work like that. You can cluster to get failover support, using Windows Server's clustering feature and SQL Server's virtual server support. You can't cluster to get better performance.
Even if your SAN would allow you to do that (and I don't think it would - I hope it wouldn't!) SQL Server gets most of its performance from caching data from the database files in RAM. It has no provision for invalidating that cache, so a change made by one server would not necessarily be seen by another server.
Transactional replication is pretty costly since all servers have to commit the transaction, so every transaction becomes a distributed transaction. This pushes costs of writes way up.
The recommended plan is, reportedly, to partition your data - to place some of the data on one server and some on another. This will never provide equal load balancing. It's not easy to do - your client now needs to know which server to look on, it's hard to dynamically change the partitions. Backing up becomes more problematic.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|