|
Roger
|
|
|
|
|
That's quite a large question. Personally i would read the relevant system tables from both databases to data tables of a VB program and then compare the rows I have in both data tables.
Is there some specific issue you're stuck with?
|
|
|
|
|
SQL Server allows you to query the schema of the database; Mika's first link explains that. I recently searched for open-source projects that accomplish this task and the best thing I found is this Codeproject-article: SQL Server Database Comparison Tool[^].
It appears to have some flaws because it didn't find the differences of two database-schemas I compared with it, but it contains all kinds of SQL-queries to query the database-schema which you could use as a starting point for your own solution.
|
|
|
|
|
Sorry friends. You wrote a lot's of replies here .
But I'm not asking for someone to write my code.
I need only some steps , with words , not with code.
thank you !
|
|
|
|
|
|
dilkonika wrote: I need only some steps , with words , not with code. Then I must have misread. Looked to me like a post that contained the steps got the answer "how to do this with code in vb.net."
Get some sleep and try again tomorrow. If any of the steps are too vague, simply ask for more explanation.
FWIW, I'd start by Googleing for the SQL-command to use to restore a backup. After that, probably executing that as a NonQuery. Then, Googeling for "sys.objects", or how to get a list of all objects in Sql Server. If you Google hard enough you'll even find a copy of a poster that contains all the relations between those system tables
Then I'd be making a list of all the objects in DB A, and probably store it in a new database (DB C). Then I'd be making a list of all the objects in DB B, and store that result as a table too. Then all that is left is comparing those two lists, and displaying the difference. I'd probably do that by trying to JOIN those lists, displaying the result in a datagridview.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
sorry , but in my opinion you should not respond with " Googleing".
If all the things are clear in google , then why you keep open this forum ?
|
|
|
|
|
dilkonika wrote: If all the things are clear in google Google is not "documentation", it is a search-machine. You can easily look up what the command is, or you buy a book with all the commands and go through the pages to find all switches.
dilkonika wrote: then why you keep open this forum ? I don't! I'm just someone who signed up here and became a member, just like you! There's no employees here that are paid to get you your answers, there's only passers-by that might just be friendly enough to help.
If you want to know why, well, go ahead and read about it in the help-section. I'll gladly help with any question. Some basic pointers if required to get started, specific help with errors, I can do. Finding alternative solutions, sure.
..but you will have to write your own code, that is not our job
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
dilkonika wrote: And who ask to you to write my code ? I ask for steps. And a step is not
" Go to goolge and search about this ....." What is a step in your opinion?
dilkonika wrote: For example look at one of my recent question Looks a lot better than this one, don't it?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
If a have the problem " how can I add 2 numbers entered by user" The steps are :
- read the first number using inputbox
- make the same thing with other number
- add 2 numbers.
and if my recent question looks better , please respond to it because no one give a response. Because I think is a question given only by code , and not everyone understand.
|
|
|
|
|
|
In a vb.net 2010 application, I want to make a minor change to an existing application. I want to pass the value of 'SchoolNum' into the sql listed below but I am getting an error message. I do not know what the error message is since the object is not accessible
The following is the code of where the call is coming from:
Letter is an object that is passed between different parts of the application.
Dim SchoolNum As String = '332'
_dtDetail = SelectDetail(Letter, SchoolNum)
The following is the function that is executed.
"Public Function SelectDetail(ByVal Letter As Letter, ByVal SchoolNum As String) As DataTable"
Public Function SelectDetail(ByVal Letter As Letter, ByVal SchoolNum As String) As DataTable
Dim _dt As DataTable = New DataTable()
Dim SchoolNumber As String = SchoolNum
Const sql As String = "SELECT d.LINK,d.absdt " _
& ",CAST(ROUND(SUM([ABSCNT]), 2) AS NUMERIC(24,2)) AS absentCount " _ & "FROM ADetails d INNER JOIN AASTU s ON d.link = s.link " _
& "INNER JOIN AASCH sch ON d.schoolnum = sch.schoolnum " _
& "WHERE d.STULINK = @link " _
& "AND d.schoolnum = + SchoolNum " _
& "GROUP BY d.LINK,d.absdt " _
& "ORDER BY d.ABSDT ; "
Using con As SqlConnection = DB.OpenConnectionS()
Using da As SqlDataAdapter = New SqlDataAdapter(sql, con)
Try
da.SelectCommand.Parameters.Add("@link", SqlDbType.Int).Value = Letter.Link
da.Fill(_dt)
Catch ex As Exception
End Try
End Using
End Using
Return _dt
End Function
#End Region
Thus can you show me the code where I can pass in a string value called SchoolNum into the function called 'SelectDetail' so the sql will execute successfully?
|
|
|
|
|
What is the error message, and what line of code does it refer to? What is it about the function call that you do not understand? The parameters are quite clearly specified above.
|
|
|
|
|
Don't use string concatenation to pass the parameter - you'll leave your code vulnerable to SQL Injection[^].
Instead, pass the parameter in the Parameters collection, in the same way as the Letter.Link parameter:
Const sql As String = "SELECT d.LINK,d.absdt " _
& ",CAST(ROUND(SUM([ABSCNT]), 2) AS NUMERIC(24,2)) AS absentCount " _
& "FROM ADetails d INNER JOIN AASTU s ON d.link = s.link " _
& "INNER JOIN AASCH sch ON d.schoolnum = sch.schoolnum " _
& "WHERE d.STULINK = @link " _
& "AND d.schoolnum = @SchoolNum " _
& "GROUP BY d.LINK,d.absdt " _
& "ORDER BY d.ABSDT ; "
Using con As SqlConnection = DB.OpenConnectionS()
Using da As SqlDataAdapter = New SqlDataAdapter(sql, con)
da.SelectCommand.Parameters.Add("@link", SqlDbType.Int).Value = Letter.Link
da.SelectCommand.Parameters.AddWithValue("@SchoolNum", SchoolNum)
da.Fill(_dt)
End Using
End Using
You should also remove the Try..Catch block, which is swallowing the exception, making it virtually impossible to debug the error.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks that solved the issue!
|
|
|
|
|
I'm maintaining code that has a VB6 TextBox as an ActiveX control running in an ASP .Net 2.x web app. For a host of reasons the web page has to run in Compatibility Mode or the ActiveX controls won't run in IE 10 + 11. But for this particular control I see the text in the multiline TextBox truncated to only the first character (and even that is slightly chopped off) at certain zoom factors (including 100%) in IE 10 and 11 in Compatibility mode. Runs fine in IE 9 and earlier. If I zoom the page it redraws fine at all zoom factors. But if I refresh the page, it fails again.
This gets more bizarre. The truncation is not just the text but the background fill as well. Only the upper left approx 10x10 px redraws.
I have tried to force the element to redraw itself using (see http://stackoverflow.com/questions/8840580/force-dom-redraw-refresh-on-chrome-mac):
var item = document.getElementById('myItem');
var sVal = item.style.display;
item.style.display = 'none';
item.style.display = sVal;
This works but ONLY if I use this code within my onKeyDown routine. It DOESN'T work if I call it in the window::onload routine. WTH?
I also tried setting item.runtimeStyle.visibility to 'hidden' and back to 'visible', but that didn't work at all.
Any suggestions on where I should look or what I should try?
Bill Cumming
modified 10-Apr-15 17:23pm.
|
|
|
|
|
Why are you using an ActiveX control from VB6? What features does it give you that the built-in <asp:TextBox> / <input type="text" /> / <textarea> elements don't have?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The quick answer is cuz it's old code and the developers are long gone. Dunno if they knew about it.
Alas I have had this legacy project dropped in my lap. I don't know VB, ASP .Net or JavaScript, (I'm a C# kinda guy) so I'm clueless to know where to look in the plumbing between them all to know what to check.
I don't fully understand what extra behavior the ActiveX gave them - the events I see it handling are nothing special. Your suggestion sounds reasonable to me so I'll look into it. I would still like to know why it's failing though....
Thanks for the suggestion
Bill Cumming
|
|
|
|
|
Hello !
In this list of windows Messages : http://www.pinvoke.net/default.aspx/Constants/WM.html[^]
which is the message that has to do with pressing the Enter key and the TAB key?
I try with WM_KEYDOWN , but it seems that the enter and the tab key are not handled.
Thank you !
|
|
|
|
|
It's been a while since I did ought like this but the WM_CHAR message should contain the key that actually went "down" I think
|
|
|
|
|
I try the WM_CHAR too , but doesn't work for TAB and Enter.
|
|
|
|
|
Er.. yes it does... how are you checking for those keys
|
|
|
|
|
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = WM_CHAR Then
Return
End If
MyBase.WndProc(m)
End Sub
End Class
all the other keys are blocked , but if TAB or Enter key is pressed then MyBase.WNDProc(m) is executed.
|
|
|
|
|
This will capture all of the keys using the ProcessCmdKey override rather than WndProc
Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean
Const WM_KEYDOWN As Integer = &H100
If ((msg.Msg = WM_KEYDOWN)) Then
Select Case (keyData)
Case Keys.Tab
Me.Label1.Text = "Tab Key Captured"
Case Keys.Enter
Me.Label1.Text = "Enter Key Captured"
Case Keys.Return
Me.Label1.Text = "Return Key Captured"
Case Else
Me.Label1.Text = keyData.ToString
End Select
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function But I really don't understand your problem as this also works for me.
Protected Overrides Sub WndProc(ByRef m As Message)
Const WM_CHAR = &H102
If m.Msg = WM_CHAR Then
Return
End If
MyBase.WndProc(m)
End Sub
|
|
|
|