Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have Table1, inside I have 3 diferent fields and 1 field which type is boolean(yes/no). When I try to retrive the records that

are checked with

"Dim com As String = "SELECT field1,field2,field3,field4 FROM Table1 WHERE field4 = 1""

I don't get anything.

There is no errors,everything passes,everything works and my datagrid is still empty.

Help anyone????

Posted

Apparently your query does not find any records.

 

 

 

Open MS Access.

 

Try out with the MS Access Queries until you have created a query that actually produces results. Switch to the "SQL" View in Access and copy the string.

.nerd
Posted

Non of this solves the problem.

Heiko's sugestions works in Accsses , but when I pass the exact same string from VB .NET still my datagrid is empty.

Robby's sugestion doesn't help either.

Everything passes , and still nothing happens.

Thanks for trying to help.

I'm still interested in solwing the problem.

Posted

Private Sub First_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

Dim com As String = "SELECT field1,field2,field3,field4 FROM(Table1) WHERE (((Table1.field4)= True));

Dim ole As New OleDbDataAdapter(com, OleDbConnection1)

ole.Fill(Ds1, "Table1")

 

End Sub

 

The SELECT query was generated from MS Accsses ,I inserted it like it came from SQL View and still nothing happens.

I have selected, in properties window, the DataSource property and it is set to Table1.

Posted

Idea:

Select * from Table1.

 

 

Now have a look at the returnvalue for field4. Is iit 1, 0, -1 or TRUE or "True" or whatever.

 

Then edit the SQL.

 

It seems you have brackets in abundance .. you should reduce their number. Actually your SQL statement doesn't require ANY brackets "( )" at all.

.nerd
  • Leaders
Posted
what is Ds1 a regular dataset or typed dataset? and are you sure Table1 in your dataset is what is bound to the datagrid? Where's your binding code?
--tim
Posted

I solved the problem like this:

created a connection in server explorer.

drag-and-drop oledbconnection1 and oldataadapter1 on to the project.

changed the select command text "SELECT * from Table1 where field4 = true"

And it worked like I wanted to work.

But still it doesn't work if I want to do it programaticly.

If someone can still help me with that I'll be wery happy.

I'll work like this until someone shows me the way to do it.

 

Thanks to all of you who showed intrest to help stupid me with the smallest of problems with jast a few lines of code .

But what hapens when the projects start to get big?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...