|
Have a little Google[^]mojo
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I would have replied in a bitter way but the way you gave me the result it was so funny that i took the link thanks , btw i searched but i did not use the same words u did
|
|
|
|
|
That's why it is called mojo, comes from experience and having been down that path before. Good on you for taking the info and getting some value out of it, a lesser person would not have got past the implied insult.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Can I get back to you in a couple of days on the topic?
I are Troll
|
|
|
|
|
Create PROCEDURE [dbo].[WidgetServer_GetAllShopList_FR]
(
@CatalogID nvarchar(max),
@PageSize INT,
@PageIndex INT,
@NoOfPages INT OUTPUT
)
AS
DECLARE @StartRowIndex INT
DECLARE @Delimiter CHAR
DECLARE @iIndex SMALLINT
DECLARE @iCatalogId INT
DECLARE @iNoofPages INT
-- DECLARE @CatalogID nvarchar(max)
--DECLARE @PageSize INT
--DECLARE @PageIndex INT
--DECLARE @NoOfPages INT
-- SET @CatalogID='1,2,3';
-- SET @PageIndex = 1;
-- Set @PageSize = 5;
SET NOCOUNT ON;
SET @StartRowIndex= ((@PageIndex * @PageSize) + 1);
BEGIN
SET @Delimiter = ','
WHILE @CatalogID <> ''
BEGIN
SET @iIndex = CHARINDEX(@Delimiter, @CatalogID)
IF @iIndex > 0
BEGIN
SET @iCatalogId = LEFT(@CatalogID, @iIndex-1)
SET @CatalogID = RIGHT(@CatalogID, LEN(@CatalogID) - @iIndex)
END
ELSE
BEGIN
SET @iCatalogId = @CatalogID
SET @CatalogID = ''
END
BEGIN
SET @iNoofPages = (SELECT ISNULL((SELECT ((COUNT(*) / @Pagesize) + CASE WHEN (COUNT(*) % @Pagesize) > 0 THEN 1 ELSE 0 END)
FROM dbo.Shops INNER JOIN Folder ON Folder.ShopID = Shops.ShopID
INNER JOIN [Catalog] ON Catalog.CatalogID = Folder.CatalogID
WHERE Catalog.CatalogID = (@iCatalogId) AND dbo.Shops.[Status] = 1),0));
END
SELECT Distinct Shops.ShopName_FR as ShopName, Shops.ShopID,Catalog.CatalogID, Catalog.CatalogName_FR as CatalogName, Folder.FolderName_FR as Folder
FROM Catalog INNER JOIN
Folder ON Catalog.CatalogID = Folder.CatalogID INNER JOIN
Shops ON Folder.ShopID = Shops.ShopID Where Catalog.CatalogID = (@iCatalogId)
END
END
In this while looping first we will get NoofPages=4 and then 2
I need to add those to values and get in NoofPages
Can any one tell me how?
Yamuna
|
|
|
|
|
PLEASE use
tags when posting your code.
Are you trying to get the sum of noofpages?
<pre>
Declare
@Var INT
Select @Var = SUM(case statement)
From ....
Print '@Var ' + Convert(varchar(1000),@Var)
|
|
|
|
|
hi
Thanks for your reply
how can we get the NoofPages count here thru when case?
explain in detail.
regards,
Yamuna
|
|
|
|
|
yamunarani wrote: explain in detail.
The new snd codz plz
Sorry if you cannot work it out then I can't help you.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi All
How can i install and configure mssql database server for netwoek?I have a network and all machine is member of domain.How can i make connection through client with server?In the client side i have Xp OS and Server Side XP server 2003.
Plz help me
|
|
|
|
|
Open Surface Area configuration for your server and enable remote connections then clients will be able to connect to it through a valid username and password.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Thanks for reply.I am try to do.
|
|
|
|
|
Sorry to say there is no effect.Still i am hunting how to connect.
Can you provide me how o install MsSQL server on Server machine then configure on client machine document.
Plz help me.
|
|
|
|
|
Persumably you have access to the media for SQL Srver (it does not automatically come with Windows Server 2003, but is a separate product). If so the installation istructions for SQL Server 2008 can be found here[^]. There are similar instructions for each version of SQL Server since SQL 7.0 elsewhere on the same web server. Just navigate to the "SQL Server" node and select the appropriate version.
It is not likely that anyone will be willing to duplicate all of those instructions in a reply to your post, so your best bet is to use the provided link.
|
|
|
|
|
i am inserting two record in data base usin txtReg and txtname using acess database when i run my program it shows following error
Execute Nonquery : Connection properly has not been initialized
here is my code
need help
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb ;
namespace studentManagementSystem1
{
public partial class StudentDetails : Form
{
public OleDbCommand cmd;
public OleDbConnection con;
string connectionString, query;
public StudentDetails()
{
InitializeComponent();
}
private void StudentDetails_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'studmanageDataSet.master' table. You can move, or remove it, as needed.
this.masterTableAdapter.Fill(this.studmanageDataSet.master);
connectionString =@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\studentManagementSystem1\studmanage.mdb";
}
private void btnAdd_Click(object sender, EventArgs e)
{
int rows;
query = "INSERT INTO master(RegNo,Name)VALUES(@RegNo,@Name)";
cmd = new OleDbCommand(query, con);
con = new OleDbConnection(this.connectionString);
cmd.Parameters.AddWithValue("@RegNo", txtRegNo.Text );
cmd.Parameters.AddWithValue("@Name", txtName.Text );
try
{
con = new OleDbConnection(this.connectionString);
con.Open();
rows = cmd.ExecuteNonQuery();
if (rows > 0)
{
MessageBox.Show("records inserted successfully");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
con.Close();
}
}
private void btnEdit_Click(object sender, EventArgs e)
{
}
}
}
|
|
|
|
|
I would say just change the order of these two lines from:
cmd = new OleDbCommand(query, con);
con = new OleDbConnection(this.connectionString);
to:
con = new OleDbConnection(this.connectionString);
cmd = new OleDbCommand(query, con);
because you initializing your OleDbCommand (cmd) with a not initilized connection value.
Edit:
I reviewed your code and saw some other things you do wrong.
Your function btnAdd_Click should look like:
private void btnAdd_Click(object sender, EventArgs e)
{
int rows;
query = "INSERT INTO master(RegNo,Name)VALUES(@RegNo,@Name)";
con = null;
try
{
con = new OleDbConnection(this.connectionString);
con.Open();
cmd = new OleDbCommand(query, con);
cmd.Parameters.AddWithValue("@RegNo", txtRegNo.Text );
cmd.Parameters.AddWithValue("@Name", txtName.Text );
rows = cmd.ExecuteNonQuery();
if (rows > 0)
MessageBox.Show("records inserted successfully");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
if(con != null)
con.Close();
}
}
Greetings
Covean
PS: Its a not the best way to do queries in the ui-code.
|
|
|
|
|
Two points:
1. This is a database forum not a c# one which is where your question should go as it's an ADO.Net issue.
2. If you have already started a thread, don't start a new one on exactly the same issue 12 hours later.
Have you even tried using Google to find an answer by searching on the error message?
|
|
|
|
|
1) You have already asked this question in another thread on this forum
2) You have been advised this is not the correct forum for your question
3) It's clear you don't understand what you are doing. Go read a book, then come back and ask any questions in the appropriate forum.
only two letters away from being an asset
|
|
|
|
|
Good Day All
I have a Package created and hosted in a Machine(Theresa) that has SQL 2008 and i have my Development Machine(Vuyiswa) that has IIS and am Debugging from the my machine. i have a ASP.NET 2.0 App and am executing a Package that in another machine. The First thing i did was to share a directory where the Packages are stored when i install the packages and supplied "Everyone","ASP.NET","Vuyiswa" Accounts permissions to to access this share. i can go into the share from the another machine without any problem. i have a code like this in my ASP.NET App
try
{
Application app = new Application();
Package package = null;
package = app.LoadPackage(@"D:\Program Files\Microsoft SQL Server\100\DTS\Packages\OMEGA\OMEGA.dtsx", null);
Variables vars = package.Variables;
vars["Time1"].Value = time;
vars["Time2"].Value = time;
vars["Time3"].Value = time;
vars["TTBLTYPE"].Value = THREAD_DATA[1].ToString();
Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
if (results == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure)
{
foreach (Microsoft.SqlServer.Dts.Runtime.DtsError local_DtsError in package.Errors)
{
Console.WriteLine("Package Execution results: {0}", local_DtsError.Description.ToString());
Console.WriteLine();
}
}
}
catch (DtsException ex)
{
Exception = ex.Message;
}
This execute Fine until the
Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
it does not stop here , but i trap it here
if (results == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure)
and the Error am Getting is
"SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E4D.\r\nAn OLE DB record is available. Source:\"Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E4D Description: "Login failed for user 'sa'
On my Package i use the "sa" credentials and my Protection Level is "Dont Save Sensative"
Thank you
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Does your sql server support sql authentication? It is usually not enabled by default, but must be turned on.
|
|
|
|
|
yes it does. i have resolved this Problem by adding a dts config file. The Problem was that the Connection Manager was not saving the Password. so i had to make sure that is there by Explicitly adding it in the config File.
Thank you for your Reply
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi all,
I used VS2005 with EnumAvailableSqlServers to list all the SQL Server, but when I upgrade to VS Team 2008, EnumAvailableSqlServers does not list SQL 2000 Server in the list.
Imports Microsoft.SqlServer.Management.Smo.SmoApplication
Dim dtServer As DataTable = EnumAvailableSqlServers(False)
Please help me!
Thanks a lot.
|
|
|
|
|
Have you upgraded Sql Server as well ?
SMO is changed in Sql Server 2008
|
|
|
|
|
Not yet, I use SQL Server 2005 Express and SQL Server 2000. Do I have to upgrade my SQL Server to 2008?
|
|
|
|
|
No... Have you taken the proper reference to SMO dll.. Actually if you have, it should be working.
The dlls will only change if you change the Version of Management objects. Check if the reference is kept intact after installing VS 2008.
|
|
|
|
|
My VS Team 2008 DVD only have SQL 2005 Express. Thus, I have to buy SQL 2008 or only need SQL 2008 Express?
Thanks.
|
|
|
|