نحوه ارتباط با بانک اطلاعاتی با نوشتن کد

سلام
دوستان ببخشید اگر این همه سوال می پرسم آخه من یه تازه کارم:sad:
دوستان اگر ممکن ارتباط با بانک اطلاعاتی از طریق نوشتن کد رو به طور کامل توضیح بدین یا یه منبعی معرفی کنید که بنده بتونم ازش استفاده کنم

راستی کدش با زبان vb.net باشه

پیشاپیش از کلیه دوستانی که بنده رو راهنمایی می کنند کمال تشکر رو دارم
 

rah

Member
میشه بگین با چه بانک اطلاعاتی میخواین ارتباط برقرار کنین ...
 
دوستان لطفا به من کمک کنید به خدا کارم گیره این کد هستش

البته من خودم از کد زیر استفاده کردم
کد:
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Protected[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Page_Load([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Load
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] constr [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#800000]"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\hekmat.mdb;Persist Security Info=True"
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] myConnection [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDbConnection(constr)
[/SIZE][SIZE=2][COLOR=#008000]' Creat new sql command and setting reqire properties 
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] myCommand [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDbCommand
myCommand.Connection = myConnection
myCommand.CommandText = [/SIZE][SIZE=2][COLOR=#800000]"SELECT * FROM asami)"
[/COLOR][/SIZE][SIZE=2]myCommand.CommandTimeout = 60
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] myDataReader [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] OleDbDataReader 
myConnection.Open()
myDataReader = myCommand.ExecuteReader()
[/SIZE][SIZE=2][COLOR=#0000ff]While[/COLOR][/SIZE][SIZE=2] myDataReader.Read()
a = a + 1
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]While
[/COLOR][/SIZE][SIZE=2]myConnection.Close()
TextBox2.Text = a
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE]

ولی موقع اجرا این پیغام رو میده
کد:
[B][I]Syntax error in FROM clause.[/I] [/B]

[FONT=Arial, Helvetica, Geneva, SunSans-Regular, sans-serif][B]Description: [/B]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. 

[B]Exception Details: [/B]System.Data.OleDb.OleDbException: Syntax error in FROM clause.

[B]Source Error:[/B] 

Line 20:         Dim myDataReader As OleDbDataReader Line 21:         myConnection.Open()[COLOR=red]Line 22:         myDataReader = myCommand.ExecuteReader()[/COLOR]Line 23:         While myDataReader.Read()Line 24:             a = a + 1
[B][FONT=Verdana]Source File: [/FONT][/B]d:\WebSites\WebSite7\Default.aspx.vb[B][FONT=Verdana]    Line: [/FONT][/B]22[/FONT]

خواهش می کنم کمکم کنید:cry::cry::cry:
 

MDP

Well-Known Member
کد:
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Protected[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Page_Load([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Object[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].Load
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] constr [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#800000]"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\hekmat.mdb;Persist Security Info=True"
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] myConnection [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDbConnection(constr)
[/SIZE][SIZE=2][COLOR=#008000]' Creat new sql command and setting reqire properties 
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] myCommand [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] OleDbCommand
myCommand.Connection = myConnection
myCommand.CommandText = [/SIZE][SIZE=2][COLOR=#800000]"SELECT * FROM asami"
[/COLOR][/SIZE][SIZE=2]myCommand.CommandTimeout = 60
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] myDataReader [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] OleDbDataReader 
myConnection.Open()
myDataReader = myCommand.ExecuteReader()
[/SIZE][SIZE=2][COLOR=#0000ff]While[/COLOR][/SIZE][SIZE=2] myDataReader.Read()
a = a + 1
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]While
[/COLOR][/SIZE][SIZE=2]myConnection.Close()
TextBox2.Text = a
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE]
 

جدیدترین ارسال ها

بالا