|
Try this out!
At the top most of your code window, type these name spaces
Import System.Data
Import System.Data.Oledb
double click on the search button and type or copy the below code
Dim con As New Oledb.OledbConnection("Provider=Microsoft.Ace.Oledb.12.0; Data Source = theDatabasePath")
Dim cmd As New Oledb.OledbCommand("select * from tblname where srchName = @srchName", con)
cmd.Parameters.AddWithValue("@srchName", txtsrch.Text)
Dim dr As Oledb.OledbDataReader = cmd.ExecuteReader
if dr.HasRows Then
dr.Read()
txtresult.Text = dr("srchName")
else
MsgBox("Name not found")
End if
dr.Close
cmd.Dispose
con.Dispose
con.Close
//////
Explanation
the srchName, I assumed to be your field name.
Table name is the name you gave your table at the backend
databasepath is the path that lead to your database. You can get the db path by right clicking on the database tehen select properties
|
|
|
|
|
Thanks u very much ... Thanks u
|
|
|
|
|
I was looking into using data annotations to help validation on one of my classes. However, in my class there is a property called CommandFamily which is a Byte . This property must have a value of 0x01 - 0x07 or 0xFF.
I have already applied the Required attribute and was looking into using the Range . However the Range attribute can only accept a minimum and maximum value and you cannot apply more then one Range attribute.
I checked on MSDN and I don't see any other attribute that will allow you to apply a list of values. I would really like to avoid having to change the acceptable values for the CommandFamily property if possible. Is there any way data annotation attribute, or combination, that will allow me to specify a range of acceptable values, instead of just a single range?
Thanks in advance for any assistance or guidance on this.
A black hole is where God tried to divide by zero.
There are 10 kinds of people in the world; those who understand binary and those who don't.
|
|
|
|
|
The simplest option would probably be to use the CustomValidation attribute[^] to call a Public Shared method to validate the value.
Public NotInheritable Class CommandFamilyValidator
Public Shared Function Validate(ByVal commandFamily As Byte) As Boolean
Return commandFamily = &H01 _
OrElse commandFamily = &H07 _
OrElse commandFamily = &HFF
End Function
End Class
...
<CustomValidation(GetType(CommandFamilyValidator), "Validate")> _
Public Property CommandFamily As Byte
...
Alternatively, you could create your own validation attribute by inheriting from the ValidationAttribute class[^]. This SO answer[^] has an example.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi All
I comme back with another Question.
i have followed droptiles tutorial and I would like to implement It. But I would like to display in the tile content (at the place of image) a div contening a chart. could you please help me achieve it? thanks in advance for your help!
Notice: I have around 10 of my usercontrol in the page, each one with its chart.
Sorry for my english. i hope you will understand my request.
Here is what a started
<div id="metro-sections-container" class="metro">
<div class="metro-sections">
<div class="metro-section" data-bind="foreach: tiles">
<div class="tile">
<div class="tile-icon-large">
<%----%>
<%----%>
</div>
</div>
</div>
</div>
</div>
and the script:
<script>
function Tile(param) {
this.label = ko.observable(param.label);
this.count = ko.observable(param.count);
this.icon = ko.observable(param.icon);
this.MyuserControl = ko.observable(param.MyuserControl);
}
var tile1 = new Tile({
label: "Label 1",
count: 10,
icon: "img/CutTheRope.png",
MyuserControl: "What will be here?"
});
var tile2 = new Tile({
label: "Label 2",
count: 20,
icon: "img/Desktop.png",
MyuserControl: "What will be here?"
});
var tile3 = new Tile({
label: "Label 3",
count: 30,
icon: "img/avatar474_2.gif",
MyuserControl: "What will be here?"
});
function ViewModel() {
this.tiles = ko.observableArray([]);
}
var viewModel = new ViewModel();
viewModel.tiles.push(tile1);
viewModel.tiles.push(tile2);
viewModel.tiles.push(tile3);
ko.applyBindings(viewModel);
window.setInterval(function () {
ko.utils.arrayForEach(viewModel.tiles(), function (tile) {
tile.count(tile.count() + 1);
});
}, 1000);
window.setTimeout(function () {
viewModel.tiles.push(new Tile({
label: "Label 3",
count: 30,
icon: "img/avatar474_2.gif",
MyuserControl: "What will be here?"
}));
jQuery('.metro-section').sortable();
}, 1000);
</script>
|
|
|
|
|
Wrong forum; try one of the web development forums on here.
|
|
|
|
|
I need to compare 2 tables and show the difference like this:
CurrentValue-Change Status(Delete,update,new)- PreviousValue
Test1 Update Test
Dim dtBenefitsCurrent As New DataTable=GetData()
Dim dtBenefitsPreviousYear As New DataTable=GetData()
?????
dtBenefitsCurrent.Merge(dtBenefitsCurrent)
Dim changesTable As DataTable = dtBenefitsCurrent.GetChanges ???????
|
|
|
|
|
Hi,
Can you do it this way ?
Dim tblDiff As DataTable = (From rA In dtBenefitsCurrent.AsEnumerable()Join rB In dtBenefitsPreviousYear.AsEnumerable() On rA.Field(Of Integer)("RowID") = rB.Field(Of Integer)("RowID") Into joinedRowsFrom ab In joinedRows.DefaultIfEmpty() Where ab Is NothingrA).CopyToDataTable(
I havent tested this, hence plz try and revert.
Hope this helps !!
Regards,
Praneet
|
|
|
|
|
I have copy your code and its not working
|
|
|
|
|
Hi, I am beginner and I am using Highcharts for first time but I am experiencing same difficulties.
I looking for a sample of code which can how to configure and update highcharts in vb.net (change type, set Axis format, change background-color, make refresh, etc. I am using Visual studio 2008
|
|
|
|
|
Those appear to be JavaScript-only charts for use in web apps and with no ASP.NET server-side wrappers. This means you can't set them up from your VB.NET code. There won't be any samples in VB.NET.
If they support Ajax calls back to your server (ASP.NET and MVC), then you can send JSON formatted data back to them and they might update themselves.
There are demos on their own site, but they are going to be JavaScript only.
There is also a CodePlex open source project called DorNet.HighCharts, found here[^], but who is working on the project and support is up to you to determine if it's useful.
|
|
|
|
|
Hello !
I'm using entity framework with vb.net.
I need to know , which is the value of Context.Entry(Myobject).state in these cases :
1) I Add Myobject as new (Savechanges is not called yet) and after I modify it ?
2) I Add Myobject as new ( Savechanges is not called yet) and after i delete it ?
3) MyObject is a parent , and I add a new child for it ?
Thank you !
|
|
|
|
|
How about this. TRY IT!
Its' not that hard to figure out if you just set a breakpoint on the SaveChanges call and look at the values in the object in question in the debugger.
|
|
|
|
|
Thank you !
But I need to know before writing my application , because If these state aren't like I think I need to find another way.So please if someone knows , explain to me which are the states in these case.
Thank you !
|
|
|
|
|
Then write a small test application and try it.
Research is a large part of software development.
|
|
|
|
|
Hello !
I have a project in vb.net 2013 , Entity Framework 6 and SQL server 2008R2.
I have this situation :
In database I have 2 tables :
Table 1 : ID (aUTONUMBER, primary kEY) , Name , vl1
Table 2 : ID (AUTONUMBER , primary KEY) , name , value , Table1_id (Foreign key related with ID field in Table1).
In my Form :
I HAVE 2 BINDINGSOURCES : Table1BindingSource and Table2Bindingsource.
I have 3 buttons : New1 - that add new record in Table1BindingSource , New2 - that add a new record in Table2BindingSource , SAVE - tHAT SAVE ALL to database.
I HAVE PROBLEMS IN THIS CASE :
I ADD A NEW RECORD IN Table1BindingSource . After I Add new record to Table2Bindingsource ( but since the id field in Table1Bindingsource is not set yet, I set the Table1_id=0 for this new record ).
After I press the Save button that has this code :
--------------------------------------------------
Table2bindingsource.SuspendBinding()
context.savechanges()
For each itm in table2bindingsource
itm.Table1_id=Table1bindingsource.current.id
Next
Table2bindingsource.ResumeBinding()
context.savechanges()
-----------------------------------------------------
But after this , in database I have 1 record in Table1 , but on Table2 I have no records.
What can I do , because I need that users can add records to both bindingsources and after to press the save button ?
Thank you !
|
|
|
|
|
dilkonika wrote: What can I do You can ponder what would happen if the same record got an unique id on each server. Hint; it would exist twice.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I haven't used EF before, so this might not apply. Then again, using BindingSources takes away some repetitive and boring code, but also introduces a bit of a black box.
Your resulting copy-table would also include its own PK and have the original PK as a FK as shown in your example. That means waiting until the record is inserted into table 1, before it can be inserted into table 2. Means you probably can't simply "link" them.
A simpeler idea is to use (spit*) triggers. You simply copy the entire record into an exact copy of the table. The fun thing is that it allows you to reuse the queries designed for table1 on table2. Also works at the database-layer, taking another responsibility away from the client.
*) It is required to spit when talking about triggers.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
help me please
add new table in access database with vb2010
edit table name and save changes with vb2010
delete table with vb2010
i wany fill access tables in listview with vb2010
and can edit selected table name and save in database with vb2010
and i can delete table with vb2010
thanks
|
|
|
|
|
|
You need to ask something much more specific than "please do my job for me."
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi All...
I will explain what I need in as much detail as possible.
I need some kind of vb script,batch file or whatever to move a file into a separate folder when the program finds a word inside the file.
I have approx 900 files in a folder.One is a vehicle and one is a map for a game.They are mixed together and the only way of telling them apart is by opening each one with my hex editor and search for the word body,which means it is a vehicle.If the "body" word is not found,it is a map.Example of the files: mapname.idf carname.idf
If possible I would like a program to search for the body word and move all those files into a separate folder called vehiclesonly in the same folder where all these .idf files are.The files that do not have the "body" word in it can be left where they are.
Here is a link to one map and one vehicle file for an example:
Thanks a bunch!
Val
|
|
|
|
|
VBScript has a InStr[^] function which you could use to see if a string occurs in another string. Means you'd be looping all files, reading them as a string, checking whether it contains the word, and then performning your action.
I can help out if you have questions on any of those tasks, but I cannot write the code for you.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hello !
I have a project in vb.net and sql server 2008R2 , Entity framework .I try to make a model refresh from database.
Before making the refresh , everything was ok , and on datasources I have added with Datasource configuration Wizard some object , and all were ok.
After the refresh , on Data Sources , all my object have a yellow triangle and the expression : "object name.." is no longer available.Verify the class name is correct and the reference to this class is still valid."
I try to insert the object again , I open the DataSource Configuration Wizard - I choose Object -Next.Here I have only app1 and app1.My.But when I expand I can't find any of the objects.
It's strange because on the right side on visual studio, if I click on Class View I can see all the object if I expand App1.
But on wizard there aren't. Before the refresh everything was ok.
I clean the solution and rebuild the solution again .But it's the same situation.
I close and open visual studio several times but nothing.
What can I do ?
Thank you !
|
|
|
|
|
dilkonika wrote: What can I do ? Google, and learn how an EF database is updated.
I have never used EF, mainly because the Wizards tend to hide stuff. That would make me dependent on their idea of how the data should flow and how updates should work.
There's a topic here[^]
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|