0

Hello.

I have a SQL database called bd with a table called dados.
I want to get one row from it.

Web.config

<add connectionString="Data Source=(local);Initial Catalog=bd;Integrated Security=True" name="bd" providerName="System.Data.SqlClient"/>

variable declarations

Dim DS As New bd
Dim a1row As bd.dadosRow

this code in the method won't return anything.
In fact it throws a "object not set to an instance of an object" error.

a1row = DS.dados.FindBycode(5440987) 

but if I perform a query I get the values: <img alt="snapshot" src="https://www.flickr.com/photos/29661370@N04/21923636492/"/>

Where did I go wrong?
Thanks

Edited by nosfa: formating

3
Contributors
3
Replies
26
Views
2 Years
Discussion Span
Last Post by Miurei
0

thanks Shark_1 but the error was on the other line of code I should have posted and didn't
dadosTA.Fill(DS.dados)

I don't know how it was but now that it is like this it works

0

Hi nosfa, are you trying to view your data in a listview table or in textboxes?
You may use queries attached on your searchbox like:

Dim sql = "SELECT UName,Password FROM [databaseName].[dbo].[tableName] WHERE UName = '" & TextBox1.Text & "' AND Password = '" & TextBox2.Text & "'"
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.