Showing posts with label sqldataadapter. Show all posts
Showing posts with label sqldataadapter. Show all posts

Wednesday, March 7, 2012

Error with Select Statement using the SQLDataAdapter Wizard

Error with Select Statement using the SQLDataAdapter Wizard
------------------------

I am needing to setup the data adapter for my SQL database for use with a web page that submits employment applications. When using the wizard I get this error: Incorrect syntax near the keyword 'FROM'. Beings that the code is generated by VB I am confused what would be incorrect. If anyone can see the problem please let me know. THANKS!

Here is the code that is giving me the error:

SELECT
FROM
[Personal Info] INNER
JOIN
Education ON
[Personal Info].[Applicants SSN] = Education.[Applicants SSN] INNER JOIN Legal ON [Personal Info].[Applicants SSN] = Legal.[Applicants SSN] INNER JOIN [Military Service] ON [Personal Info].[Applicants SSN] = [Military Service].[Applicants SSN] INNER JOIN [Employment History] ON [Personal Info].[Applicants SSN] = [Employment History].[Applicants SSN] INNER JOIN [References] ON [Personal Info].[Applicants SSN] = [References].[Applicants SSN] INNER JOIN [Farm Preference] ON [Personal Info].[Applicants SSN] = [Farm Preference].[Applicants SSN]

Quote:

Originally Posted by sds50

Error with Select Statement using the SQLDataAdapter Wizard
------------------------

I am needing to setup the data adapter for my SQL database for use with a web page that submits employment applications. When using the wizard I get this error: Incorrect syntax near the keyword 'FROM'. Beings that the code is generated by VB I am confused what would be incorrect. If anyone can see the problem please let me know. THANKS!

Here is the code that is giving me the error:

SELECT
FROM
[Personal Info] INNER
JOIN
Education ON
[Personal Info].[Applicants SSN] = Education.[Applicants SSN] INNER JOIN Legal ON [Personal Info].[Applicants SSN] = Legal.[Applicants SSN] INNER JOIN [Military Service] ON [Personal Info].[Applicants SSN] = [Military Service].[Applicants SSN] INNER JOIN [Employment History] ON [Personal Info].[Applicants SSN] = [Employment History].[Applicants SSN] INNER JOIN [References] ON [Personal Info].[Applicants SSN] = [References].[Applicants SSN] INNER JOIN [Farm Preference] ON [Personal Info].[Applicants SSN] = [Farm Preference].[Applicants SSN]


You haven't selected anything. You should have:

SELECT field1,field2 ... etc
FROM ...

Sunday, February 26, 2012

Error with databound datagrid

Help,

I have a simple app that only has on datagrid that is bound by the typical sqlconnection,sqldataadapter and dataset. But I keep getting this error:

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Data.SqlClient.SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
Source Error:

Line 55: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadLine 56: 'Put user code to initialize the page hereLine 57: SqlDataAdapter1.Fill(DataSet11)Line 58: DataGrid1.DataBind()Line 59:

WHY :)

xactly what the message says..can you post the connection string ?

|||
Indeed, fix your connectionstring. Get that working before messing withdatagrids. The error indicates that you're telling ADO.NET to use atrusted connection (i.e. windows authentication) but the ASPNET useraccount probably doesn't have access to your database. I typically useSQL authentication so I can limit the damage each application can do.One account per database.