Why I am getting this error: Microsoft.Data.SqlClient.SqlException Message=A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 26 - Error Locating Server/Instance Specified)
Hi Is it better to use an API? Or will this work. I can connect my maui app directly to sql db. Im not sure if it is a good design. But it means we don't need to build an API. All mobile clients can talk directly to SQL database using a connection string over internet.
Yes of course :) But api are used to connect with multiple devices on multiple areas where as direct SSMS connection is confined with same place over shared internet.
Never do this! This is a horrible example and is exactly what not to do. You need an API. Yes it’s more work, but here he has opened SQL to attacks and removes any business logic. You mobile app will contain the username and password to your server. 30 seconds of decompiling will give a hacker access to your database. Furthermore this is horribly expensive as each query connects and authenticates before the query can be executed. An api allows you to use a connection factory which reuses connections. Done the way he does it here, each connecting device is another connection. Honestly you could write a whole book on why not to do this.
my friend do you really was saved my life with you tutorial because i was search for hours one video who can explain that like this and men , you are the best ! thanks again my friend
Nota importante: Sólo funciona con la versión system.data.sqlclient v4.8.2 (quizá tiene un bug), y sin duda es mala practica acceder directo a sql server, pero el ejemplo es muy educativo.
por alguna razon solo funciona cuando esta conectado a la misma red wifi. Si pruebo la aplicacion MAUI en el emulador Android si funciona, se conecta correctamente, si lo pruebo en un celular fisico conectado a la misma red WIFI si funciona correctamente, pero si el celular fisico esta conectado a otra red WIFI no me permite conectarme al SQL Server. Tu video esta muy bueno
@@gerardoarielmendez5037 es porque cada red wifi es privada, para que se conecte desde otras redes wifi la bd deberia estar en un servidor que tenga permitidas conexiones remotas o en en todo caso abrir los puertos del modem de la red privada y permitir conexiones en el puerto 1433 que es el default de sql server
Wow, Thank you, so basically, this method is for LAN connection only which doesn't require any internet connection? This is helpful, especially in the voting system within the school only and any other use cases apply. Any chance we could get the CRUD?? looking forward to it..👌👌
We can make lots of small scale apps with in the organization. And this mobile apps needs internet connection for sure as it needs sql server IP address to be connected. But the main advantage is you can visualize the database and manipulate it with your own. CRUD Is the next part. 🙂
A lot of wrong explanations here... Hard coded strings of connection is a WRONG approach, using Open() instead of OpenAsync() (why do you use Open()????), wrong settings for SqlServer as well... I don't know what to say about your video, but definitely, it is not a good setup!
I respect your thought. I am getting synchronized data and want to load my large data at first then only show my UI. I agree Open Async() is what need to be used
@@xamaringuy1951 OpenAysnc() is the way, getting data async, not synchronously and use an animated spinner to indicate that data is being received ;) Always use Async/Await, never block the UI.
Excuse Me Bro I am Getting this Error Can You Please help me to Fix this Problem Thanks A lot , I am Using With .net Maui Project.. "A connection was successfully established with the server but then an error pre-login handshake "
the new maui doesnt support fucking system.data.sqlclient. ı take this error always. I'm gonna break my computer ı swear !!!!! Microsoft.Data.SqlClient.SqlException: 'A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)'
Hunting for this solution since last 6-7 months. Thanks
Fantastic !! This is one of your very best tutorial !!
THANKS YOU SOOOOOO MUCH! MEN YOU SAVED MY LIFE AHAHHAAH
I'll have a celebration in your honor tomorrow
Why I am getting this error:
Microsoft.Data.SqlClient.SqlException
Message=A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 26 - Error Locating Server/Instance Specified)
I have same error like you
Superb way to explain , Very nice keep it up bro
Hi
Is it better to use an API? Or will this work. I can connect my maui app directly to sql db. Im not sure if it is a good design. But it means we don't need to build an API. All mobile clients can talk directly to SQL database using a connection string over internet.
Yes of course :) But api are used to connect with multiple devices on multiple areas where as direct SSMS connection is confined with same place over shared internet.
Never do this! This is a horrible example and is exactly what not to do. You need an API. Yes it’s more work, but here he has opened SQL to attacks and removes any business logic. You mobile app will contain the username and password to your server. 30 seconds of decompiling will give a hacker access to your database. Furthermore this is horribly expensive as each query connects and authenticates before the query can be executed. An api allows you to use a connection factory which reuses connections. Done the way he does it here, each connecting device is another connection. Honestly you could write a whole book on why not to do this.
Hello. Will it also work with the 'Developer' version of SQL Server?
This is so underrated. You're amazing
Thank you
That's great thank you.
A question if you allow: can we call a sql server SP ?
sure you can
my friend do you really was saved my life with you tutorial because i was search for hours one video who can explain that like this and men , you are the best ! thanks again my friend
Nota importante: Sólo funciona con la versión system.data.sqlclient v4.8.2 (quizá tiene un bug), y sin duda es mala practica acceder directo a sql server, pero el ejemplo es muy educativo.
this not working om maui it works in xamarin forms only have you tested it on maui
Why you dont show if his works?
can you help to get the same connection in Blazor MAUI I TRIED BUT ITS NOT WORKING
por alguna razon solo funciona cuando esta conectado a la misma red wifi. Si pruebo la aplicacion MAUI en el emulador Android si funciona, se conecta correctamente, si lo pruebo en un celular fisico conectado a la misma red WIFI si funciona correctamente, pero si el celular fisico esta conectado a otra red WIFI no me permite conectarme al SQL Server.
Tu video esta muy bueno
Encontraste alguna solucion?
@@gerardoarielmendez5037 es porque cada red wifi es privada, para que se conecte desde otras redes wifi la bd deberia estar en un servidor que tenga permitidas conexiones remotas o en en todo caso abrir los puertos del modem de la red privada y permitir conexiones en el puerto 1433 que es el default de sql server
nice work it
🥳🥳🥳
thank you very much for this tutorial
Welcome 😊
Wow, Thank you, so basically, this method is for LAN connection only which doesn't require any internet connection? This is helpful, especially in the voting system within the school only and any other use cases apply. Any chance we could get the CRUD?? looking forward to it..👌👌
We can make lots of small scale apps with in the organization. And this mobile apps needs internet connection for sure as it needs sql server IP address to be connected. But the main advantage is you can visualize the database and manipulate it with your own. CRUD Is the next part. 🙂
Looking forward to it, TIA..
Gostei muito! Aguardando a continuação, seria possível enviar uma consulta e obter o resultado em um datatable? Esta mensagem é do Brasil!
Yes, It's possible please wait for the next video.
My machine is not working SQL connection with visual studio and xamarin
Thanks a lot. best tutorial
A lot of wrong explanations here... Hard coded strings of connection is a WRONG approach, using Open() instead of OpenAsync() (why do you use Open()????), wrong settings for SqlServer as well... I don't know what to say about your video, but definitely, it is not a good setup!
I respect your thought. I am getting synchronized data and want to load my large data at first then only show my UI.
I agree Open Async() is what need to be used
@@xamaringuy1951 OpenAysnc() is the way, getting data async, not synchronously and use an animated spinner to indicate that data is being received ;) Always use Async/Await, never block the UI.
how can i secure my connection string ??
Hi how can use it with ios app
Shall I create APK and use in mobile
using System.Data.SqlClient; not working in .NET MAUI for net6.0-android
Same here
How did you fix the problem?
Same goes for me
How Did you Fix the Problem?
Did you get it to work? if yes, can you tell me how'd you do it? Thanks!
same. but no solution yet. Recommendations like "use package Version 3.0.1 and cs parameter encrypt = false does not work.
Excuse Me Bro I am Getting this Error Can You Please help me to Fix this Problem Thanks A lot , I am Using With .net Maui Project.. "A connection was successfully established with the server but then an error pre-login handshake "
i have the same problem and did not find a solution yet.
Unfortunately it does not work with iOS devices. :(
Namaskar sir
Please help me
Lol, what is practical use of connection to SSMS on mobile app ?
This is no sense, you should use your local sqlite.lol
The practice use case will be you will be creating Api with the sql database. Where as local SQLite.net is just for local storage of info.
bad
the new maui doesnt support fucking system.data.sqlclient. ı take this error always. I'm gonna break my computer ı swear !!!!! Microsoft.Data.SqlClient.SqlException: 'A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)'
For windows and iOS app I was able to connect my sql clinet in dotnet Maui but there’s the issue with android.
@@xamaringuy1951 when will they fix it ?
same error to me also, trying to figure out since 1 month but still no luck. If anyone found the answer please share
@@arastunasimsek8992 Solution?
using System.Data.SqlClient; not working in .NET MAUI for net6.0-android
Solution?