15,908,173 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Anshumaan Chaturvedi (Top 52 by date)
Anshumaan Chaturvedi
25-Aug-14 15:24pm
View
Yeah.this would do. All i needed was your confirmation to save time...Big time thanks.
Sergey
Anshumaan Chaturvedi
25-Aug-14 14:39pm
View
Yeah. that's what , i am able to select form a dropdownlist and at the same time it's like a textbox where i can edit the database name. Which is not acceptable.
So, i should only be able to select but not be able to edit in that combobox.
Anshumaan Chaturvedi
25-Aug-14 14:26pm
View
No,sir.. thing is that user should be able to select the existing database name from the dropdownlist but shouldnot be able to edit it once selected from the list.So, this might work but let me take the call and see. I'll kep you posted. If you can suggest something else also, i would be greatful
Anshumaan Chaturvedi
25-Aug-14 14:01pm
View
thanks... i got the clear picture.
Anshumaan Chaturvedi
25-Aug-14 13:48pm
View
So this will still allow the user to select from the ComboBox? I am asking coz i can test it only when i create the installer which takes a painful 45 minutes
Anshumaan Chaturvedi
14-Aug-14 15:58pm
View
Thanks.
Anshumaan Chaturvedi
14-Aug-14 15:46pm
View
Guys...chill... we solved it. :D Thanks for your support... I am learning something fruitful at last
Anshumaan Chaturvedi
14-Aug-14 14:50pm
View
thanks, it worked. So irrespective of what the root node is, it will eventually find the descendant node. Am i correct?
Anshumaan Chaturvedi
14-Aug-14 14:40pm
View
IT's throwing :XMLException
Message:
Name cannot begin with the '/' character, hexadecimal value 0x5C.
Anshumaan Chaturvedi
14-Aug-14 13:18pm
View
Hey, I have tried to get Firmware_Crc but the element is under another node
.how do i resolve that?
Anshumaan Chaturvedi
14-Aug-14 11:01am
View
I am sorry but I didn't get the part :
XElement xml=XElement.Parse(stringWithXml);
this stringWithXml is what actually?
P.S. I am fairly new to .NET
Anshumaan Chaturvedi
5-Aug-14 9:30am
View
Thanks you Sir. Yes I am a beginner. 3 months only into .NET. Long way to go.
Cheers!!
thanks again for your help and sharing the knowledge
Anshumaan Chaturvedi
5-Aug-14 9:02am
View
some implementation example links ?
Anshumaan Chaturvedi
5-Aug-14 8:50am
View
please see the updated question
Anshumaan Chaturvedi
5-Aug-14 3:07am
View
Well, the case was handled already. Irrespective of what case it is,the elements are read in Datatable except Settings.
Anshumaan Chaturvedi
23-Jul-14 13:52pm
View
The statement in Procedure was working fine with previous table. Same Schema, Same Structure
Anshumaan Chaturvedi
23-Jul-14 13:25pm
View
It is actually PluginSettingXrefValue and no , there is no trigger, the values are populated from code side. Code side implementation is correct.
Anshumaan Chaturvedi
23-Jul-14 13:23pm
View
my bad .... let me update the question
Anshumaan Chaturvedi
17-Jul-14 10:43am
View
thanks Praveen. Awesome.
Anshumaan Chaturvedi
17-Jul-14 10:37am
View
This one is far more easier and optimized. you guys rock.
Anshumaan Chaturvedi
17-Jul-14 10:09am
View
Bravo Pikoh... this initiated my thought process of generating the series.
Anshumaan Chaturvedi
17-Jul-14 9:48am
View
it is coming as 1.0.1.71 and not 1.0.1.8
Anshumaan Chaturvedi
17-Jul-14 9:43am
View
No, only the PluginVersion variable. that's it.
if (checkExists(pluginRegistrationEntity))
{
pluginRegistrationEntity.PluginVersion += 1; /// Errorneous logic
string cmdText = "Update PluginRegistration set PluginVersion='" + pluginRegistrationEntity.PluginVersion + "'where PluginName='" + pluginRegistrationEntity.PluginName + "' && Device Type='" + pluginRegistrationEntity.DeviceType + "' && DeviceManufacturer='" + pluginRegistrationEntity.DeviceManufacturer + "' && DeviceModel='" + pluginRegistrationEntity.DeviceModel + "'";
SqlHelper.ExecuteReader(Dsn, CommandType.Text, cmdText);
return 1;
Anshumaan Chaturvedi
17-Jul-14 9:39am
View
This data is being read from an xml file and before storing it in a particular table of a DB
it needs to be increment in a conditional code section.
Anshumaan Chaturvedi
11-Jul-14 11:53am
View
It's not throwing any error but just not loading 69 projects in solution.. I am not able to view them in my solution explorer
Anshumaan Chaturvedi
3-Jul-14 8:54am
View
Please elaborate.....if you can
Anshumaan Chaturvedi
3-Jul-14 8:50am
View
Sir, let me be honest, i don't know up to your "esteemed level", I am just a college grad in intern, and people instead should encourage for the efforts any fresher puts,not discourage them :) Thanks for your kind words
Anshumaan Chaturvedi
3-Jul-14 8:47am
View
Could you elaborate? Please if you can..
Anshumaan Chaturvedi
3-Jul-14 8:33am
View
I have been able to compare but still stuck for inserting value.Any suggestion
Anshumaan Chaturvedi
3-Jul-14 8:10am
View
exactly, property names with data column value to map setting value.
Anshumaan Chaturvedi
3-Jul-14 5:37am
View
I do. I should attach it to .exe project but i am not allowed to do that. It is working with unknowing thing.
Anshumaan Chaturvedi
3-Jul-14 3:27am
View
public SqlDataReader GetRegistrationInfoSetting(string categoryName, int instanceID)
{
string sqlCmdText = "usp_GetRISettingByInstanceIdAndCategoryId";
SqlParameter[] param = new SqlParameter[1];
SqlParameter InstanceId = new SqlParameter("@InstanceId", instanceID);
SqlParameter Category_Name = new SqlParameter("@CategoryName", categoryName);
param[0] = InstanceId;
param[1] = Category_Name;
SqlDataReader reader=SqlHelper.ExecuteReader (Dsn, System.Data.CommandType.StoredProcedure, sqlCmdText,param);
if (reader.HasRows)
{
while (reader.Read())
{
var dataRead = reader.GetValue(0).ToString().Trim();
}
}
else
{
reader.Close();
}
return reader;
}
}
This reader which is of SqlDatareader type, will it hold all the records present in table?
Anshumaan Chaturvedi
3-Jul-14 2:53am
View
I have to save it in a list or may be in an array
Anshumaan Chaturvedi
27-Jun-14 6:59am
View
I have but duplication arises. I mainly wanted to have a review.
Anshumaan Chaturvedi
18-Jun-14 7:13am
View
Thing is the database name was manually changed in the SQl Server Management studio.The user is recreating the database with the same name that is present in physical drive.My requirement is to rename the .mdf and .ldf file in DATA folder.
Say for example i created a database 'abc'
I manually went and changed it to 'abc_old' but in physical path that is in
"C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\" the name is still 'abc' and not 'abc_old'
Now to resolve the problem i wanted to rename the file in DATA folder. For that i have to fetch the path for both the files. I am getting .mdf file but not .ldf file.
How should i proceed now?
Anshumaan Chaturvedi
18-Jun-14 6:23am
View
Brother, I am new and have very less knowledge. If you could show me how to do it properly?
Anshumaan Chaturvedi
18-Jun-14 5:40am
View
string dataFilePath;
string logFilePath;
SqlCommand cmdspText = new SqlCommand("GetAllPhysicalPath", conn);
cmdspText.CommandType = CommandType.StoredProcedure;
cmdspText.Parameters.AddWithValue("@txtDatabaseName", userSpecifiedDBNameInTxtBox);
cmdspText.ExecuteNonQuery();
SqlDataReader reader = new SqlDataReader();
while(reader.Read())
{
//what should i write here
}
Anshumaan Chaturvedi
18-Jun-14 5:39am
View
string dataFilePath;
string logFilePath;
SqlCommand cmdspText = new SqlCommand("GetAllPhysicalPath", conn);
cmdspText.CommandType = CommandType.StoredProcedure;
cmdspText.Parameters.AddWithValue("@txtDatabaseName", userSpecifiedDBNameInTxtBox);
cmdspText.ExecuteNonQuery();
SqlDataReader reader = new SqlDataReader();
while(reader.Read())
{
//what should i write here
}
Anshumaan Chaturvedi
18-Jun-14 2:30am
View
How to do it? Could you explain?
Anshumaan Chaturvedi
17-Jun-14 7:38am
View
Hey that works. Thanks Alexander
Anshumaan Chaturvedi
17-Jun-14 5:13am
View
Will try it now
Anshumaan Chaturvedi
17-Jun-14 5:13am
View
Thanks Phil....
Anshumaan Chaturvedi
16-Jun-14 8:18am
View
I guess, i should use executeReader because there are more than one rows which needs to be read.
Anshumaan Chaturvedi
16-Jun-14 8:16am
View
Getting InvalidOperationException
String[0]: the Size property has an invalid size of 0.
Eagerly waiting for your reply
Anshumaan Chaturvedi
16-Jun-14 8:12am
View
Getting InvalidOperationException
String[0]: the Size property has an invalid size of 0.
Anshumaan Chaturvedi
16-Jun-14 8:11am
View
My stored Procedure :
USE [master]
GO
/****** Object: StoredProcedure [dbo].[CleanInstall] Script Date: 06/16/2014 15:54:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- Batch submitted through debugger: SQLQuery9.sql|7|0|C:\Users\c5038671\AppData\Local\Temp\~vs3ACC.sql
ALTER PROCEDURE [dbo].[CleanInstall]
@backUpDirectoryPath VARCHAR (500) OUT
AS
BEGIN
IF OBJECT_ID('tempdb..#instances') is not null DROP TABLE #instances
IF OBJECT_ID('tempdb..#directories') is not null DROP TABLE #directories
CREATE TABLE #instances (Name VARCHAR(255), InstanceName VARCHAR(255))
CREATE TABLE #directories (TypeName VARCHAR(255), DirPathName VARCHAR(255))
DECLARE @regInstanceKey VARCHAR(500)
DECLARE @instance VARCHAR(255) -- current instance
DECLARE @ver VARCHAR(255) -- MS SQL version
DECLARE @key VARCHAR(255) -- Registry key on server side
DECLARE @value_name VARCHAR(255) -- Registry value name
DECLARE @instance_name VARCHAR(255) -- Key value name for the instance of SQL Server 2000
DECLARE @version INT -- SQL Server version (integer)
DECLARE @ic INT
SET @instance_name = ''
INSERT INTO #instances
EXEC xp_instance_regread @rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'SOFTWARE\\Microsoft\\Microsoft SQL Server',
@vn = 'InstalledInstances',
@backUpDirectoryPath = @regInstanceKey OUTPUT;
SELECT @ic = COUNT(*) FROM #instances
WHERE InstanceName = @@servicename
IF( @ic = 1 ) BEGIN
SELECT @instance = InstanceName FROM #instances
WHERE InstanceName = @@servicename
SELECT @ver = SUBSTRING(CAST(SERVERPROPERTY('productversion') AS VARCHAR(255)), 1, 2)
IF(RIGHT(@ver,1) = '.') SET @version = CAST(LEFT(@ver,1) AS INT)
ELSE SET @version = CAST(@ver AS INT)
IF ( @version = 8) BEGIN
IF (@instance <> 'MSSQLSERVER' ) SET @key =
'SOFTWARE\\Microsoft\\Microsoft SQL Server\\' + @instance + '\\MSSQLServer\\'
ELSE SET @key = 'SOFTWARE\\Microsoft\\MSSQLServer\\MSSQLServer\\'
END
ELSE IF ( @version > 8) BEGIN
EXEC xp_instance_regread @rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'SOFTWARE\Microsoft\\Microsoft SQL Server\\Instance Names\\SQL',
@vn = @instance,
@value = @instance_name out
SET @key = 'SOFTWARE\\Microsoft\\Microsoft SQL Server\\' + @instance_name + '\\MSSQLServer'
END
SET @value_name = 'DefaultData'
EXEC xp_instance_regread @rootkey = 'HKEY_LOCAL_MACHINE',
@k = @key,
@vn = @value_name,
@backUpDirectoryPath = @regInstanceKey OUTPUT;
IF @regInstanceKey = @instance_name SET @regInstanceKey = NULL
INSERT INTO #directories
VALUES ('DefaultData', @regInstanceKey)
SET @value_name = 'DefaultLog'
EXEC xp_instance_regread @rootkey = 'HKEY_LOCAL_MACHINE',
@k = @key,
@vn = @value_name,
@backUpDirectoryPath = @regInstanceKey OUTPUT;
IF @regInstanceKey = @instance_name SET @regInstanceKey = NULL
INSERT INTO #directories
VALUES ('DefaultLog', @regInstanceKey)
SET @value_name = 'BackupDirectory'
EXEC xp_instance_regread @rootkey = 'HKEY_LOCAL_MACHINE',
@k = @key,
@vn = @value_name,
@backUpDirectoryPath =@regInstanceKey OUTPUT;
INSERT INTO #directories
VALUES ('BackupDirectory', @regInstanceKey)
IF @regInstanceKey = @instance_name SET @regInstanceKey = NULL
END
END
SELECT * FROM #directories
SELECT * FROM #instances
DROP TABLE #instances
DROP TABLE #directories
Anshumaan Chaturvedi
16-Jun-14 8:10am
View
Yes
Anshumaan Chaturvedi
16-Jun-14 8:10am
View
USE [master]
GO
/****** Object: StoredProcedure [dbo].[CleanInstall] Script Date: 06/16/2014 15:54:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- Batch submitted through debugger: SQLQuery9.sql|7|0|C:\Users\c5038671\AppData\Local\Temp\~vs3ACC.sql
ALTER PROCEDURE [dbo].[CleanInstall]
@backUpDirectoryPath VARCHAR (500) OUT
AS
BEGIN
IF OBJECT_ID('tempdb..#instances') is not null DROP TABLE #instances
IF OBJECT_ID('tempdb..#directories') is not null DROP TABLE #directories
CREATE TABLE #instances (Name VARCHAR(255), InstanceName VARCHAR(255))
CREATE TABLE #directories (TypeName VARCHAR(255), DirPathName VARCHAR(255))
DECLARE @regInstanceKey VARCHAR(500)
DECLARE @instance VARCHAR(255) -- current instance
DECLARE @ver VARCHAR(255) -- MS SQL version
DECLARE @key VARCHAR(255) -- Registry key on server side
DECLARE @value_name VARCHAR(255) -- Registry value name
DECLARE @instance_name VARCHAR(255) -- Key value name for the instance of SQL Server 2000
DECLARE @version INT -- SQL Server version (integer)
DECLARE @ic INT
SET @instance_name = ''
INSERT INTO #instances
EXEC xp_instance_regread @rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'SOFTWARE\\Microsoft\\Microsoft SQL Server',
@vn = 'InstalledInstances',
@backUpDirectoryPath = @regInstanceKey OUTPUT;
SELECT @ic = COUNT(*) FROM #instances
WHERE InstanceName = @@servicename
IF( @ic = 1 ) BEGIN
SELECT @instance = InstanceName FROM #instances
WHERE InstanceName = @@servicename
SELECT @ver = SUBSTRING(CAST(SERVERPROPERTY('productversion') AS VARCHAR(255)), 1, 2)
IF(RIGHT(@ver,1) = '.') SET @version = CAST(LEFT(@ver,1) AS INT)
ELSE SET @version = CAST(@ver AS INT)
IF ( @version = 8) BEGIN
IF (@instance <> 'MSSQLSERVER' ) SET @key =
'SOFTWARE\\Microsoft\\Microsoft SQL Server\\' + @instance + '\\MSSQLServer\\'
ELSE SET @key = 'SOFTWARE\\Microsoft\\MSSQLServer\\MSSQLServer\\'
END
ELSE IF ( @version > 8) BEGIN
EXEC xp_instance_regread @rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'SOFTWARE\Microsoft\\Microsoft SQL Server\\Instance Names\\SQL',
@vn = @instance,
@value = @instance_name out
SET @key = 'SOFTWARE\\Microsoft\\Microsoft SQL Server\\' + @instance_name + '\\MSSQLServer'
END
SET @value_name = 'DefaultData'
EXEC xp_instance_regread @rootkey = 'HKEY_LOCAL_MACHINE',
@k = @key,
@vn = @value_name,
@backUpDirectoryPath = @regInstanceKey OUTPUT;
IF @regInstanceKey = @instance_name SET @regInstanceKey = NULL
INSERT INTO #directories
VALUES ('DefaultData', @regInstanceKey)
SET @value_name = 'DefaultLog'
EXEC xp_instance_regread @rootkey = 'HKEY_LOCAL_MACHINE',
@k = @key,
@vn = @value_name,
@backUpDirectoryPath = @regInstanceKey OUTPUT;
IF @regInstanceKey = @instance_name SET @regInstanceKey = NULL
INSERT INTO #directories
VALUES ('DefaultLog', @regInstanceKey)
SET @value_name = 'BackupDirectory'
EXEC xp_instance_regread @rootkey = 'HKEY_LOCAL_MACHINE',
@k = @key,
@vn = @value_name,
@backUpDirectoryPath =@regInstanceKey OUTPUT;
INSERT INTO #directories
VALUES ('BackupDirectory', @regInstanceKey)
IF @regInstanceKey = @instance_name SET @regInstanceKey = NULL
END
END
SELECT * FROM #directories
SELECT * FROM #instances
DROP TABLE #instances
DROP TABLE #directories
Anshumaan Chaturvedi
16-Jun-14 7:58am
View
Coudl you find any fault in this.??
using System;
using System.Data;
using System.IO;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TestForLogic
{
class Program
{
static void Main(string[] args)
{
string[] targetPath;
using (SqlConnection connection = new SqlConnection("Server=BNGTSIDTPC0738;User=sa;Password=login@234;Initial Catalog=master;Connection Timeout=120"))
using(SqlCommand cmd = new SqlCommand("CleanInstall", connection))
{
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter backUpDirectoryPath = new SqlParameter("@backUpdirectoryPath", SqlDbType.VarChar)
{
Direction=ParameterDirection.Output
};
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(backUpDirectoryPath);
connection.Open();
cmd.ExecuteNonQuery(); //it is giving an Exception . String[0] has size 0
connection.Close();
}
}
}
}
Anshumaan Chaturvedi
16-Jun-14 6:23am
View
could you elaborate please, i,m a freshmen. Don't know much about coding. It's for practice.
Anshumaan Chaturvedi
12-Jun-14 9:59am
View
So this gets me all the instances of SQL server installed on local machine or on network also??
Finally this stored procedure will give me a path name or what ?
Anshumaan Chaturvedi
12-Jun-14 2:13am
View
Is traversing through this path "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA" possible when the file is having read-only property on. I am actually running the search engine code for searching a file with particular name.
Show More