MS Access Form filter dropdown - sql-server

Having created a copy of an Access DB Backend in SQL Server, the Access Frontend has stopped showing the "Filter" list when the Filter button is pressed on the main form:
Before:
After:
I'm not sure what is causing this. In the old frontend I am opening the form like this:
Set rs = CurrentDb.OpenRecordset(sSQL)
Where sSQL is like:sSQL= "Select * from [EventReport]"
And in the new version I'm opening the form like this:
Set rs = CurrentDb.OpenRecordset(sSQL, dbOpenDynaset, dbFailOnError + dbSeeChanges)
I'm not sure if any of this is actually relevant to the issue, by any help is appreciated!
Tom

a bit more googling found the answer. In Access Options I needed to turn on the ODBC Fields in the Filter Lookup options for the Current Database

Related

How to update some data in SQL server into null for Classic ASP

I want to make update function in a web based system using Classic ASP to enable the user to cancel their application. I'm not using delete function because some data should be maintained, and some data will be set into NULL. This function also allow the user to choose date range in a form to delete their application.
There is no error shown but the set of data is not updated when click on cancel button in the form.
This is the code :
<%param="keyid=" & session("keyid")
idkehadiran=request("idkehadiran")
nokpl=request("nokpl")
set SimpanRS=server.CreateObject("adodb.recordset")
sql="select * from tms_kehadiran where nokpl='"&nokpl&"' and (tarikh >= '"&tarikh&"' and tarikh <= '"&hinggaTarikh&"')"
SimpanRS.open sql,connehr,3,3
while not SimpanRS.EOF
SimpanRS("alasan")=""
SimpanRS("nokpPenyelia")=""
SimpanRS("kelulusan")=null
if isnull(SimpanRS("datecreated")) then
SimpanRS("datecreated")=now
end if
SimpanRS("lastupdate")=now
SimpanRS.update
SimpanRS.movenext
wend
SimpanRS.close
set SimpanRS=nothing
%>
I don't what are the error with this code. Can anyone help me ?
Instead of looping the RS. You should use GetRows().
After that you can update the data in the SQL server while looping the array.

How to use ADODB.Connection in Qt and query database?

As shown in my previous post QODBC/QODBC3 is not that good to work with databases. I have found a year old suggestion here to use ADODB for SQL Server. Can anyone give an example showing or suggest a link explaining How to connect, query and get result using ADODB.Connection in Qt?
You need to use QAxObject.
First you should take a look at:
QAxObject documentation: doc.qt.io/qt-5/qaxobject.html
Active X data object documentation: msdn.microsoft.com/en-us/library/windows/desktop/ms676795(v=vs.85).aspx
Here is a sample code to get you started:
// Create connection
QAxObject *connection = new QAxObject("ADODB.Connection");
connection->dynamicCall("Open(\"Provider=SQLOLEDB.1;Integrated Security=SSPI;Initial Catalog=Inaz;Data Source=SERVER02\")");
// Execute query and get recordset
QAxObject *recordSet = connection->querySubObject("Execute(\"select column01 from table01\")");
// Get fields
// or check https://msdn.microsoft.com/en-us/library/ms681510(v=vs.85).aspx to see what you can do with and how to use a recordset
QAxObject *fields = recordSet->querySubObject("Fields");
Note: You will need to call CoInitialize to use ADODB. However QGuiApplication and QApplication call it internally so you might not always need to make the call yourself.

TableAdapter.Update Does Not Save Imported Row

I've hit a problem with my database. The purpose of the section of my application is simple this; when a user marks an assignment of work complete, it will transfer one DataRow from "activeUnits" by using the "table.ImportRow" method to another table called "completedUnits" and then use the table adapter to update this change to the core database. However when testing this function the Dataset has completed the move of rows successfully internally, but upon using the TableAdapter.Update method the update of data to the database returns simply as "0" with no changes made or errors to lead.
Try
Dim activeRowMove As DataRow = Me.AssignmentDataSet.activeUnits.Rows(currentIndex)
Dim newMove As DataTable = Me.AssignmentDataSet.completedUnits
newMove.ImportRow(activeRowMove)
'UPDATE CHANGES
Me.Validate()
CompletedUnitsBindingSource.EndEdit()
Console.WriteLine(Me.CompletedUnitsTableAdapter.Update(Me.AssignmentDataSet.completedUnits))
activeUnitsTitle.Text = ("Assignment Completed!")
Catch ex As Exception
Console.WriteLine("Failed to update new table: " & ex.ToString)
activeUnitsTitle.Text = ("Failed to save!")
End Try
Is there somewhere in my code which I've simply done wrong, or any better or efficient way of moving a datarow is appreciated!
My database is not copied in my project's bin folder and every update goes to one central location.
If needed the following link is two screenshots of my current layout and data - here.
From MSDN:
Calling ImportRow preserves the existing DataRowState along with other values in the row
So, if the DataRowState in your "from" table is Unchanged, then its state will remained Unchanged in the "to" table, and it will not get saved.
Make sure to change the DataRowState of the newly imported row to Added
Cheers

Trouble with CreateNewSite() bindings -- WMI -- IIS6

I am successfully creating new IIS 6 websites using the CreateNewSite() function, but would like to add an additional two hostname bindings (see below).
Questions:
Does the CreateNewSite() function support multiple hostname bindings?
If so, what is the syntax? In all the example code I've found out there, I only find copies of the original MS code, with no examples of additional bindings, or even examples of modification functions.
I have already reviewed this blog page...
http://stweet.wordpress.com/2010/03/15/creating-a-new-website-programmatically-on-iis-using-asp-net/
... and while I saw something that looked like multiple domains, the code format was different, and so I'm not sure how it relates to the VBS I am using.
Thanks,
Mik
`
Bindings = Array(0)
Set Bindings(0) = providerObj.get("ServerBinding").SpawnInstance_()
Bindings(0).IP = myIPnumber
Bindings(0).Port = "80"
Bindings(0).Hostname = WScript.Arguments(0)
' Create the new Web site using the CreateNewSite method of the IIsWebService object.
Dim strSiteObjPath
strSiteObjPath = serviceObj.CreateNewSite("RF_" & WScript.Arguments(0), Bindings, "D:\websites\" & WScript.Arguments(0) & "\httpdocs", WScript.Arguments(2))
`
The WScript.Arguments(2) is a custom IIS service number.

MiniProfiler - SqlParameter

I am using the latest version of the MiniProfiler, everything is setup and working as I would expect. My only issue is that SqlParameters are not being displayed.
For example, I am running a stored procedure:-
var cmd = dbcon.CreateCommand();
cmd.CommandText = "USP_Admin_Subscription_List";
cmd.CommandType = CommandType.StoredProcedure;
// parameters
cmd.Parameters.Add(new SqlParameter("#UserRef", SqlDbType.NVarChar) { Value = customerRef });
When this executes I see the SQL in the MiniProfiler display but I do not see the Parameter #UserRef nor it's value.
Is this possible? It would be great to see the value so I can ensure the correct value is being passed.
I am using MVC 3
Any advice would be welcomed.
Cheers,
J
Old questions, but just in case anyone else is looking for the answer to this:
The sample code has:
// different RDBMS have different ways of declaring sql parameters - SQLite can understand inline sql parameters just fine
// by default, sql parameters won't be displayed
MiniProfiler.Settings.SqlFormatter = new StackExchange.Profiling.SqlFormatters.InlineFormatter();
You need to change it to:
MiniProfiler.Settings.SqlFormatter = new StackExchange.Profiling.SqlFormatters.SqlServerFormatter();
And your parameters will appear.

Resources