|
You can write a service that executes SQL, but you cannot export your connection, and act as if you are Sql Server.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
And what do you mean by "application server"? What is this and what does it do?
|
|
|
|
|
Like three-tier programming
User-Interface------Dekstop Workstation
Business Logic------Application Server
Data management-----Database Server
|
|
|
|
|
He wants a service where you can "request" SQL connections. Think proxy. Not gonna happen.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I was wondering what he was talking about. That's the dumbest idea for "serparation of concerns" I've heard in a while.
|
|
|
|
|
Dumb sells.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Maybe you didn't understand the request. A typical "client" knows nothing about "connections" and "application servers".
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Your desktop client may use windows authentication to allow the user access but the connection between your service and database should use a different connection (SQL userid and password) otherwise the users will be able to log into the database directly.
Desktop client -> checks with active directories user/groups for authentication passes info to service
Service (using SQL credentials) checks with database for authorisation of authenticated user.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Using WSE 3.0 component in my soap based service and cant modify it so it support only ipv4 so when we connect ISP provider IPV6 it throws the error.
How to fix it through the code or service or the network.........expectation is to work with both IPV4 and IPV6
|
|
|
|
|
|
For the moment I can only get the subfolders name of C:\Backup folder to the first column of the listBoxComputer.
Have do I get also the last written date of subfolders to the second column of the listBoxComputer?
private string rootDir = @"C:\Backup";
private void FormView_Load(object sender, EventArgs e) {
List<string> ls = Directory.GetDirectories(rootDir).Select(Path.GetFileName).ToList();
ls.Sort((a, b) => -1 * a.CompareTo(b));
listBoxComputer.Sorted = false;
listBoxComputer.DataSource = ls;
listBoxUser.SelectedIndex =-1;
}
|
|
|
|
|
Member 14055879 wrote: List<string> ls This limits you to a single column of string data. What you need to do is create a model/structure of what you want
Create a class outside this method with the fields you need
class Details{
prop string FileName{get;set;}
prop datetime FileDate{get;set;}
}
Change your list<string> to List
Iterate through the files in the folder
Get the filename and the modified/created attribute
Create a new Details instance with that information
Add the Details just created to the List
Bind the list to your listview.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
The WinForm ListBox has very limited functionality: it does not support multiple columns; the mis-named 'MultiColumn property just does whatever with the text data to avoid vertical scrolling in the control.
Use a ListView [^] instead of a ListBox.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Your query makes no sense because you're using directory information to retrieve file info using a method mis-coded as a property.
In any event, you can string multiple fields together (as "strings"), with a possible delimiter (e.g. "|"), and a mono-spaced font, with the left-field (reading left-to-right) padded out (right) to the maximum length ... to get "columns".
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I have a list which has 25000 data and I am iterating in all data and in each iteration, I am searching data in another data table. my whole routine is taking a long time to finish.
private void UpdateCommentFirst(string strCommentPath, string TickerName)
{
int counter = 0;
bool QcViewAllFileExist = false;
bool QcCommentFileExist = false;
bool AllowUpdate = false;
string savepath = Convert.ToString(ConfigurationManager.AppSettings["OutputPath"]).Trim() + TickerName + "\\" + TickerName + "_QC-ViewwAll.xml";
DataSet QCCommentstmp = new DataSet();
DataSet QCViewAlltmp = new DataSet();
if (File.Exists(strCommentPath))
{
QCCommentstmp.ReadXml(strCommentPath);
QcCommentFileExist = true;
}
if (File.Exists(savepath))
{
QCViewAlltmp.ReadXml(savepath);
QcViewAllFileExist = true;
}
if (QcCommentFileExist && QcViewAllFileExist)
{
if (QCCommentstmp.Tables.Count > 0)
{
if (!QCCommentstmp.Tables[0].Columns.Contains("IgnoreData"))
{
AllowUpdate = true;
}
}
if (AllowUpdate)
{
List<clsCommentPopup> QCCommentlist = QCCommentstmp.Tables[0].AsEnumerable()
.Select(row => new clsCommentPopup
{
bolFollowUP = (row.Field<string>("FollowUP")) == null ? false : Convert.ToBoolean((row.Field<string>("FollowUP"))),
bolThisPeriod = (row.Field<string>("ThisPeriod")) == null ? false : Convert.ToBoolean((row.Field<string>("ThisPeriod"))),
Formula = (row.Field<string>("Formula")) == null ? string.Empty : (row.Field<string>("Formula")),
ModelValue = (row.Field<string>("ModelValue")) == null ? string.Empty : (row.Field<string>("ModelValue")),
ExternalComment = (row.Field<string>("ExternalComment")) == null ? string.Empty : (row.Field<string>("ExternalComment")),
InternalComment = (row.Field<string>("InternalComment")) == null ? string.Empty : (row.Field<string>("InternalComment")),
strEndPeriod = (row.Field<string>("EndPeriod")) == null ? string.Empty : (row.Field<string>("EndPeriod")),
strStartPeriod = (row.Field<string>("StartPeriod")) == null ? string.Empty : (row.Field<string>("StartPeriod")),
PeriodType = (row.Field<string>("PeriodType")) == null ? string.Empty : (row.Field<string>("PeriodType")),
SectionFor = (row.Field<string>("Section")) == null ? string.Empty : (row.Field<string>("Section")),
LiFor = (row.Field<string>("LineItem")) == null ? string.Empty : (row.Field<string>("LineItem")),
QcPeriodFor = (row.Field<string>("QcPeriod")) == null ? string.Empty : (row.Field<string>("QcPeriod")),
BrokerFor = (row.Field<string>("BrokerFor")) == null ? string.Empty : (row.Field<string>("BrokerFor")),
PeriodCollection = (row.Field<string>("PeriodCollection")) == null ? string.Empty : (row.Field<string>("PeriodCollection")),
boolIgnoreValue = (row.Field<string>("IgnoreValue")) == null ? false : Convert.ToBoolean((row.Field<string>("IgnoreValue"))),
IgnoreData = (!QCCommentstmp.Tables[0].Columns.Contains("IgnoreData") ? string.Empty : (row.Field<string>("IgnoreData") == null ? string.Empty : row.Field<string>("IgnoreData")))
}).ToList();
if (QCCommentlist != null)
{
foreach (var comment in QCCommentlist)
{
string section = comment.SectionFor;
string li = comment.LiFor;
string broker = comment.BrokerFor;
string period = comment.PeriodCollection;
string strQCPeriodValue = "";
if (comment.boolIgnoreValue && period.Trim() != "")
{
var QcViewColumnName = QCViewAlltmp.Tables[0].Columns.Cast<DataColumn>().AsParallel()
.Where(x => x.ColumnName.Contains(period))
.Select(x => new { x.ColumnName }).FirstOrDefault();
if (QcViewColumnName != null)
{
period = QcViewColumnName.ColumnName;
if (period.Trim() != "")
{
var datarow = QCViewAlltmp.Tables[0].AsEnumerable().AsParallel()
.Where(row => row.Field<string>("GroupKey").Split('~')[0].ToUpper() == section.ToUpper()
&& row.Field<string>("GroupKey").Split('~')[1].ToUpper() == li.ToUpper()
&& row.Field<string>("Section ").ToUpper() == broker.ToUpper());
if (datarow != null && datarow.Count() > 0)
{
strQCPeriodValue = (datarow.FirstOrDefault()[period] != null ? datarow.FirstOrDefault()[period].ToString() : string.Empty);
if (strQCPeriodValue.Trim() != string.Empty)
{
comment.IgnoreData = strQCPeriodValue;
counter++;
}
}
}
}
}
}
}
SerializeQcComment(QCCommentlist);
toolTip1.Hide(this);
}
}
}
Loading data from XML file into a dataset.
If the ignoredata field is there in QCCommentstmp dataset table
QCCommentstmp.Tables[0].Columns.Contains("IgnoreData") then deserialize QCCommentstmp table data to list List<clscommentpopup> QCCommentlist.
Iterate in QCCommentlist's data using a for loop and finding data in QCViewAlltmp.Tables[0] data table for each iteration.
When QCCommentlist has 25000 data then I am iterating in all 25000 data and finding data in another data table. If data is found then I am updating data in the list. This process is getting very slow and the code is taking a long time to finish all the iteration and searching data in the data table.
Please review my code and tell me how to restructure my code, as a result, there will be the improvement in code execution speed.
If my approach is wrong then guide me with the right approach and also give me the relevant code which I can use in my above code, as a result, my routine will take minimum time to finish if I iterate in more than 25000 data. I'm looking for suggestions and better code to achieve the same task. thanks
|
|
|
|
|
Hi,
I'm no expert in LINQ, however I would avoid using it for searching as it is based on IEnumerable, so I expect a search to be basically sequential, and performance to degrade quadratically.
I would recommend first building a Dictionary<keyType, myType> with the search key as key; that would speed up your search considerably. Be careful though, all key values must be different when building the dictionary!
modified 7-Apr-19 22:15pm.
|
|
|
|
|
|
You're welcome.
|
|
|
|
|
Mou_kol wrote: I have a list which has 25000 data and I am iterating in all data and in each iteration, I am searching data in another data table. my whole routine is taking a long time to finish. XML is not optimized for search, it is an exchange-format. If you want speed, use a real database.
Also, the data needs to be normalized; having to do "Split.ToUpper" 25000 times is nonsense. Finding the data in the other table should be fast if you have the PK and or an indexed field.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
|
You're welcome.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I define and set indexes (using an initial lookup) for the column names so my methods don't have to do "column lookups" and instead index columns directly in the for loops.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Hi again,
you should use a database, it might be a temporary one, one that gets created, used, and deleted by your app. You might consider SQLite (see e.g. Getting started with SQLite in C# – Tigran's Blog[^] or Working with SQLite in C# & VB[^] ) , which works with a single data file or can hold everything in memory (see In-Memory Databases[^]).
Have your program create the database, populate it once from the XML file, cleaning the data immediately. Then perform the required operations on the database.
|
|
|
|
|
|
I am not familiar with SQLLite db. so i have few questions. i will highly obliged if you please answer.
1) SQLLite support multi user ?
2) SQLLite is single db file like MS-Access ?
3) does it has high learning curve ?
4) if some one know sql server then he can user sql server related code and knowledge along with SQLLite or all things will be totally separate ?
5) SQLLite support table data indexing, view, store procedure & trigger like sql server ?
6) can we work just copy SQLLite db file from one pc to another pc or do i need to install setup in all pc ?
7) does it have any IDE by which can design table, view & store procedure.
very sorry that i have asked 7 questions in advance. i will be glad if you answer my point wise. Thanks in advance
|
|
|
|