|
hi
how can i detect a connection string in a program?
i want to detect a connection string in a program and find the database that the program connect to it.
i am writing a program that when it add to other program with sql database it must detect the connection string and the database that the program connects to it... please help me...
|
|
|
|
|
well, this sounds nasty, but, really what you want to do is load the whole program and it's config files as binary data, then go through it looking for something that matches a regex designed to find connection strings.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i thik that your way is difficult... isnt there any way to answer this question? all the databases are sqlserver
|
|
|
|
|
Well, you could use black magic I suppose.
You have a binary file and you want to find connection strings in it. How do YOU propose to do that ? You MAY be able to write code that detects attempts to connect to a SQL Server, and find them that way. A more obvious approach is to look for SQL Servers that can be seen and then look to see what DBs they have, that would be a ton easier. It won't tell you which DB belongs to which program, obviously.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
how can load the whole program as binary data?
|
|
|
|
|
File.ReadAllBytes. Getting those bytes into strings that you can then run a regex on, is another matter. I guess you need to look for sequences that look like a string. I think the whole thing is a disaster. I assume you're assuming that the string is not in a config file, seeing as you're trying to hack into an existing program.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i cant undrestand you plese help me... i must write this program till this evening isnt there any other way?
|
|
|
|
|
Why do you have to write it this evening ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i must deliver it to my boss. i am a programmer and its a piece of our projects
|
|
|
|
|
Your boss gave you one night to write something, but when it's explained to you, you can't understand the explanation ? Your boss is an idiot.
I've explained every possible way to do this that I can think of, in the plainest possible language. I don't know what else to say.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i can undrstand you but i want just to know is there any other way? you are right... i am sorry... thank you for your help my good friend anyway
|
|
|
|
|
Hey guys,
Is there any body that worked on archive? Right now I am working on small application, which does the archive and the code was written in vb.net. It copies the database and zip that file and send that zipped file to write a DVD. This application works fine for small file but its giving error when we have data like 5 GB its giving error as below
ICSharpCode.SharpZipLib.Zip.ZipException: Maximum entry size exceeded
If any body can help, it will be grate …….appreciate your time. Thank you………
|
|
|
|
|
You should create a multi part zip, not a single 5 gb file.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hey Christian Graus,
Thank you very much for ur reply. but, please can u tell me how can i use multi part zip. i have no clue about that. i have a 5 GB database i need to archive that.
Thank you for ur time.....
|
|
|
|
|
As Christian has said, do multi-part file and just have a way to be able to work with all the parts when unzipping.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Not sure whether to put this query into the database section or here, but here goes.
I have a SQL Server database with a table of contacts (about 130,000 records). Each contact is a member of a category (9 different categories). What i need to do is count how many contacts are in each category for output in my vb.net application.
I can think of 2 methods to do this (actually 3 but the third is a definate no), which would you recommend.
Method 1 : Use a Cursor in a SQL Server stored procedure to iterate through all the contacts keeping a count of contacts in each category.
Method 2 : Get the data from the database and do the processing in my application.
Which approach do you think would ofrer the best performance?
(In case you were wondering, the 3rd method involves calling a stored procedure 9 times, once for each category and doing the count)
|
|
|
|
|
Since option 1 mentions access to stored procedures, why not write a stored procedure to return the data in one call? If the categories exist in a table, then you should be able to join on that table.
And this should be in the database section...
Tim
|
|
|
|
|
It is relatively easy to do in sql, depending on your database structure. If you give a few more details of the database structure I am sure it will be easy to write a sql query - after all, its this type of thing sql was designed for.
Liqz wrote: Method 1 : Use a Cursor in a SQL Server stored procedure to iterate through all the contacts keeping a count of contacts in each category.
Slow. Only ever use cursors if you have process on a record by record basis
Liqz wrote: Method 2 : Get the data from the database and do the processing in my application.
Could do, but you are return large volumes of data which again, you would end up processing on a record by record basis.
If the data is held in a link table something like
contactid, categoryid
The query is
select categoryid, count(*) from links group by categoryid
or, if its a single column on the contacts table with different values
select categoryid, count(*) from contacts group by categoryid
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Don't do cursors, but rather go with stored procedures. You'll be better off performance-wise.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Ah OK, thanks for the help. My novice-ness is obviously showing through!
|
|
|
|
|
Can some tell me why this would not work, i try everything and i still won't work
If updating = "y" Then
Application.ScreenUpdating = True
Else
Sheets("graph").Select
Application.ScreenUpdating = False
End If
Sheets("data").Select
endrow = Worksheets("path").Range("c12").Value
startrow = Worksheets("path").Range("c11").Value
num_columns = 1
str_col_11 = startrow & ":"
name_column = ""
If toomany = False Then
Do
num_columns = num_columns + 1
Loop While Not IsEmpty(Worksheets("data").Rows(10).Cells(num_columns))
num_columns = num_columns - 1
startc = 1
endc = num_columns
Else
to_plot = Worksheets("path").Range("c18").Value
Select Case to_plot
Case "a"
startc = 1
endc = Worksheets("path").Range("C15").Value
Case "b"
startc = 91
endc = Worksheets("path").Range("C16").Value + 90
Case "c"
startc = 181
endc = Worksheets("path").Range("C17").Value + 180
End Select
End If
' On Error GoTo errs
j = 4
If Graph.OptionButton1.Value = True Then
xax = 1
ElseIf Graph.OptionButton2.Value = True Then
xax = 2 'what do you want plotted on the x-axis?
End If
startt = Timer
For i = startc To endc
Application.StatusBar = "**** (Charting " & startc & " to " & endc & ") " & Application.WorksheetFunction.Round(((i / endc) * 100), 0) & "% Complete Memory in Use: " & Application.WorksheetFunction.Round(Application.MemoryUsed / 1000000#, 0) & " MB ****"
name_column = Worksheets("data").Cells(10, i).Value
Call Sheet1.col_lookup(i, alpha) 'lookup column alpha reference
str_setcolumn = alpha
strSelCol = str_setcolumn & startrow & ":" & str_setcolumn
Range(strSelCol & endrow).Select
Charts.Add
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Sheets("data").Range(strSelCol & endrow), PlotBy _
:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:=name_column
|
|
|
|
|
Hi!
Could you tell us what it's supposed to do? Then we might be able to give you some advice.
Thanks!
MrWolfy
|
|
|
|
|
It has already been mentioned that you should provide more details. What is supposed to happen? What is actually happening? Are there erros? If so give details.
You're more likely to get help that way.
|
|
|
|
|
What the program does is that it takes a raw data and graphs each column individually... my problem is that it graphs everything until it gets to the tenth column that is where the error occurs
|
|
|
|
|
Gentlemen thank you for your help i found the problem, and the program ran fine
|
|
|
|