473,386 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

seeDBChanges and Too few Parameters

4
Hi I have one table which I upsized to SQL Server 2005 from access. Everything seems to work fine when I use "dbOpenDynaset, [dbSeeChanges]" when needed for tbl_Clients (the table on SQL Server) but this I can't seem to make work....

sql = "SELECT tbl_Users.sFirstname as sFN, tbl_Users.sLastname, tbl_Artists.lngClientNumber as sLN, tbl_Clients.sEmail as sE, * "
sql = sql & "FROM tbl_Users RIGHT JOIN tbl_Clients ON tbl_Users.lngUserID = tbl_Clients.lngUserID "

If chkUnsubscribe = 1 Then
sql = sql & "WHERE tbl_Clients.bUnsubscribe= 0 "
End If


Set rsSource = db.OpenRecordset((sql), dbOpenDynaset, dbSeeChanges)

Any ideas??
Thanks in advance
Jan 6 '11 #1
5 2711
Rabbit
12,516 Expert Mod 8TB
You have * in there but you didn't qualify which table to get all fields from.
Jan 6 '11 #2
munkee
374 256MB
You are also using "sql" as a variable which is a reserved word. If it hasn't caused issues yet then it will likely in the future use something like strSql instead.
Jan 6 '11 #3
vikD
4
Hmmm no dice I changed it and still the same too few parameters....

strsql = "SELECT tbl_Users.sFirstname as sFN, tbl_Users.sLastname, tbl_Artists.lngClientNumber as sLN, tbl_Clients.sEmail as sE, tbl_Clients.* "
strsql = strsql & "FROM tbl_Users RIGHT JOIN tbl_Clients ON tbl_Users.lngUserID = tbl_Clients.lngUserID "


If chkUnsubscribe = 1 Then
strsql = strsql & "WHERE tbl_Clients.bUnsubscribe= 0 "
End If


Set rsSource = db.OpenRecordset((strsql), dbOpenDynaset, dbSeeChanges)
Jan 6 '11 #4
Rabbit
12,516 Expert Mod 8TB
Does that SQL string work outside of code?
Jan 6 '11 #5
vikD
4
Ohhh I'm an idiot. I inherited this code and it used to work until I upsized. After looking at the SQL it was messed up to begin with. The seeDBChanges was the solution.

Guess the moral is don't assume just because it works it's correct.

Thanks All!!
Jan 7 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
3
by: Bill Cart | last post by:
The oldDb Command does not support Named Parameters. If I am reading them correctly, the docs say that the order of the parameter should match the order they are declared in the Stored Procedure....
2
by: Mark | last post by:
I created a test to check the execution time difference between executing a SQL Server stored procedured using explicit parameters versus not. In one case I created new SqlParameters in the code,...
10
by: Adis | last post by:
Asp.Net Visual Studio 2003 SQL Server. Hi, Obtaining Data Based Upon Multiple Selections From a ListBox... I have database in Sqlserver and ListBox (Multiple Selection Mode) in my Visual...
4
by: Tim::.. | last post by:
Can someone tell me a better way or give me a link that shows a better way to create large numbers of SQL parameters... Example... A better way to write this code! <code> Sub...
1
by: Mikey G | last post by:
Hi, I created a simple VB.NET 2003 application through Visual Studio that connects to a MySQL database and loads a table into a Dataset, and then displays that table information in a DataGrid on a...
14
by: cody | last post by:
I got a similar idea a couple of months ago, but now this one will require no change to the clr, is relatively easy to implement and would be a great addition to C# 3.0 :) so here we go.. To...
18
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I...
2
by: Hexman | last post by:
Hello All, Well I'm stumped once more. Need some help. Writing a simple select and update program using VB.Net 2005 and an Access DB. I'm using parameters in my update statement and when trying...
12
by: pamelafluente | last post by:
Hi guys, In the past I have used several time optional parameters in my function. But Now I am more inclined to think that they are more dangerous than useful, and probably better to be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.